org.apache.lucene.search
public final class: Hits [javadoc |
source]
java.lang.Object
org.apache.lucene.search.Hits
A ranked list of documents, used to hold search results.
Caution: 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 HitCollector .
Note: Deleting matching documents concurrently with traversing
the hits, might, when deleting hits that were not yet retrieved, decrease
#length() . In such case,
ConcurrentModificationException
is thrown when accessing hit n ≥ current_#length()
(but n < #length() _at_start).
| Field Summary |
|---|
| boolean | debugCheckedForDeletions | |
| Constructor: |
Hits(Searcher s,
Query q,
Filter f) throws IOException {
// for test purposes.
weight = q.weight(s);
searcher = s;
filter = f;
nDeletions = countDeletions(s);
getMoreDocs(50); // retrieve 100 initially
lengthAtStart = length;
}
|
Hits(Searcher s,
Query q,
Filter f,
Sort o) throws IOException {
weight = q.weight(s);
searcher = s;
filter = f;
sort = o;
nDeletions = countDeletions(s);
getMoreDocs(50); // retrieve 100 initially
lengthAtStart = length;
}
|