java.lang.ObjectDeprecated!org.apache.lucene.search.Hits
Hits - will be removed in Lucene 3.0.
Instead e. g. TopDocCollector and TopDocs can be used:
TopDocCollector collector = new TopDocCollector(hitsPerPage);
searcher.search(query, collector);
ScoreDoc[] hits = collector.topDocs().scoreDocs;
for (int i = 0; i < hits.length; i++) {
int docId = hits[i].doc;
Document d = searcher.doc(docId);
// do something with current hit
...
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: |
|---|
|
|
| Method from org.apache.lucene.search.Hits Summary: |
|---|
| doc, id, iterator, length, score |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.apache.lucene.search.Hits Detail: |
|---|
Deprecated!
Documents are cached, so that repeated requests for the same element may return the same Document object. |
Deprecated!
|
Deprecated!
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 a search method that takes a HitCollector . |
Deprecated!
|
Deprecated!
|