lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Bowesman <>
Subject Best way to returning hits after search?
Date Tue, 27 Feb 2007 21:14:12 GMT
I am doing what I should not, i.e. iterating the Hits after a search to collect 
two ID fields from each document in Hits to pass back to the searcher along with 
the score.

The index is approx 10-15 fields per doc, and indexes mail data, which is not 
stored, as it exists elsewhere.  Each mail has a unique object ID, so that gets 
indexed as the field "contentid".

I have been looking at HitCollector, but I was wondering the best way to collect 
the contentId field and score.

In HitCollector javadoc is says that you should not use 
IndexReader.getDocument(doc) during the collection loop, but is there any 
difference between, new HitCollector() {
            public void collect(int doc, float score) {

   iterate bitset {
     IndexReader.getDocument(doc, FieldSelector)

and, new HitCollector() {
            public void collect(int doc, float score) {
                IndexReader.getDocument(doc, FieldSelector)

Given that I have to read the documents to get the relevant fields, does either 
method work?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message