⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inaccurateresultaggregation.java

📁 Lucene Hack之通过缩小搜索结果集来提升性能
💻 JAVA
字号:
package org.apache.lucene.util;

/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with this
 * work for additional information regarding copyright ownership. The ASF
 * licenses this file to You under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

/**
 * <p>
 * Rewritten by caocao (http://www.caocao.name)
 * 
 * <p>
 * InaccurateResultAggregation was designed to carry the extra info that TopDocs
 * can not carry including lastDocID, ascending, accurate, numberOfRecordsFound.
 * It's a pure value object.
 */
public class InaccurateResultAggregation {
	private int lastDocID = 0; // The last doc ID

	private boolean ascending = true; // The direction of query

	private boolean accurate = true; // The result is accurate or not

	private int numberOfRecordsFetched = 0; // As name

	private int numberOfRecordsFound = 0; // As name

	public InaccurateResultAggregation(int lastDocID, boolean ascending,
			boolean accurate, int numberOfRecordsFetched,
			int numberOfRecordsFound) {
		super();
		this.lastDocID = lastDocID;
		this.ascending = ascending;
		this.accurate = accurate;
		this.numberOfRecordsFetched = numberOfRecordsFetched;
		this.numberOfRecordsFound = numberOfRecordsFound;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("lastDocID=");
		sb.append(lastDocID);
		sb.append(" ascending=");
		sb.append(ascending);
		sb.append(" accurate=");
		sb.append(accurate);
		sb.append(" numberOfRecordsFetched=");
		sb.append(numberOfRecordsFetched);
		sb.append(" numberOfRecordsFound=");
		sb.append(numberOfRecordsFound);
		return sb.toString();
	}

	public boolean isAccurate() {
		return accurate;
	}

	public void setAccurate(boolean accurate) {
		this.accurate = accurate;
	}

	public boolean isAscending() {
		return ascending;
	}

	public void setAscending(boolean ascending) {
		this.ascending = ascending;
	}

	public int getNumberOfRecordsFetched() {
		return numberOfRecordsFetched;
	}

	public void setNumberOfRecordsFetched(int numberOfRecordsFetched) {
		this.numberOfRecordsFetched = numberOfRecordsFetched;
	}

	public int getNumberOfRecordsFound() {
		return numberOfRecordsFound;
	}

	public void setNumberOfRecordsFound(int numberOfRecordsFound) {
		this.numberOfRecordsFound = numberOfRecordsFound;
	}

	public int getLastDocID() {
		return lastDocID;
	}

	public void setLastDocID(int lastDocID) {
		this.lastDocID = lastDocID;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -