lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantyn Smirnov <inject...@yahoo.com>
Subject HitCollector and sorting
Date Mon, 02 Jun 2008 15:44:11 GMT

Hi all 

Currently I'm using the search method returning the Hits object. According
to http://wiki.apache.org/lucene-java/ImproveSearchingSpeed one should use a
HitCollector-oriented search method instead. 
But I need another aspect of the "Hits search(...)" method: it's sorting
ability.

Now my code looks like :

    def hits = multiSearcher.search( query, Methods.activeFilter, sort )
    def iter = hits.iterator()
        
    def results = []
    int counter = 0
    
    for( hit in iter ){
      if( range.contains( counter ) && hit.document ){
        results << Methods.bind( hit.document, lucenizedClasses )
      }else if( counter >= upper ) break
      counter++
    }

So, how can I get the same results using the HitCollector? Also it would be
really nice, if you could point me to some examples of using it...

Thanx in advance,
Konstantyn
-- 
View this message in context: http://www.nabble.com/HitCollector-and-sorting-tp17604363p17604363.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