lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: best way to iterate through all docs from a query
Date Thu, 19 Nov 2009 15:48:18 GMT
Simply create an own Collector (or HitCollector for Lucene < 2.9). Nothing
more to do.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: it99 [mailto:deswiatlowski@syrres.com]
> Sent: Thursday, November 19, 2009 4:37 PM
> To: java-user@lucene.apache.org
> Subject: best way to iterate through all docs from a query
> 
> 
> What is the best way to iterate across all the documents in a search
> results?
> Previously I was using the deprecated Hits object but changed the
> implentations as recommended in javadocs to ScoreDoc.
> 
> I've tried the following but I've seen warning about peformance.
> Seems the first time I query something it takes long time and then after
> that it is quick.
> 
> 
> 
>                 for (int i = 0; i < mNumberOfHits; i++)
>                 {
> 
>                     int docId = hits[i].doc;
>                     Document doc = searcher.doc(docId);
>                 }
> 
> Here's the code for the search
> What is good number to pass intot TopDocCollector?
> 
>             TopDocCollector collector = new TopDocCollector(1000000);
>             searcher.search(query, collector);
>             ScoreDoc[] hits = collector.topDocs().scoreDocs;
> --
> View this message in context: http://old.nabble.com/best-way-to-iterate-
> through-all-docs-from-a-query-tp26421373p26421373.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



---------------------------------------------------------------------
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