lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "m.harig" <m.ha...@gmail.com>
Subject RE: Read large size index
Date Tue, 30 Jun 2009 12:52:11 GMT

Thanks Uwe,

            can you please give me a code snippet , so that i can resolve my
issue , please



The correct way to iterate over all results is to use a custom HitCollector
(Collector in 2.9) instance. The HitCollector's method collect(docid, score)
is called for every hit. No need to allocate arrays then:

e.g.:
searcher.search(query, new HitCollector() {
	@Override public void collect(int docid, float score) {
		// do something with docid
	}
});

TopDocsCollector is used to get a relevance-sorted view on the top ranking
hits. It is not for iterating over the whole results (in full text search,
nobody would normally do this. E.g. Google does not allow you to go beyond
page 100). If you want to display the top 10 results you can use
TopDocCollector(10).

Uwe



-- 
View this message in context: http://www.nabble.com/Read-large-size-index-tp24251993p24271288.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message