small javadoc improvements about ids and performance

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@526550 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2007-04-08 13:17:10 +00:00
parent 2412d83aa2
commit 76dffdd6e0
1 changed files with 15 additions and 4 deletions

View File

@ -24,7 +24,14 @@ import java.util.Iterator;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.CorruptIndexException;
/** A ranked list of documents, used to hold search results. */ /** A ranked list of documents, used to hold search results.
* <p>
* <b>Caution:</b> Iterate only over the hits needed. Iterating over all
* hits is generally not desirable and may be the source of
* performance issues. If you need to iterate over many or all hits, consider
* using the search method that takes a {@link HitCollector}.
* </p>
*/
public final class Hits { public final class Hits {
private Weight weight; private Weight weight;
private Searcher searcher; private Searcher searcher;
@ -111,12 +118,15 @@ public final class Hits {
return hitDoc.doc; return hitDoc.doc;
} }
/** Returns the score for the nth document in this set. */ /** Returns the score for the n<sup>th</sup> document in this set. */
public final float score(int n) throws IOException { public final float score(int n) throws IOException {
return hitDoc(n).score; return hitDoc(n).score;
} }
/** Returns the id for the nth document in this set. */ /** Returns the id for the n<sup>th</sup> document in this set.
* Note that ids may change when the index changes, so you cannot
* rely on the id to be stable.
*/
public final int id(int n) throws IOException { public final int id(int n) throws IOException {
return hitDoc(n).id; return hitDoc(n).id;
} }
@ -127,7 +137,8 @@ public final class Hits {
* <p> * <p>
* <b>Caution:</b> Iterate only over the hits needed. Iterating over all * <b>Caution:</b> Iterate only over the hits needed. Iterating over all
* hits is generally not desirable and may be the source of * hits is generally not desirable and may be the source of
* performance issues. * performance issues. If you need to iterate over many or all hits, consider
* using a search method that takes a {@link HitCollector}.
* </p> * </p>
*/ */
public Iterator iterator() { public Iterator iterator() {