lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: IndexSearcher.search
Date Mon, 15 Sep 2008 18:08:35 GMT
Hi,

Check the Hits javadoc:

 * @deprecated Hits will be removed in Lucene 3.0. <p>
 * Instead e. g. {@link TopDocCollector} and {@link TopDocs} can be used:<br>
 * <pre>
 *   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
 *     ...
 * </pre>

Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch



----- Original Message ----
> From: Cam Bazz <cambazz@gmail.com>
> To: java-user@lucene.apache.org
> Sent: Monday, September 15, 2008 1:54:07 PM
> Subject: IndexSearcher.search
> 
> Hello,
> 
> What is the new favorable way of searching a query?
> 
> I understand Hits will be depreciated. So how do we do it the new way?
> With hit collector?
> 
> Best.
> 
> ---------------------------------------------------------------------
> 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