lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From saisantoshi <saisantosh...@gmail.com>
Subject RE: TopDocCollector vs TopScoreDocCollector (semantics changed in 4.0, not backward comptabile)
Date Wed, 27 Feb 2013 23:00:18 GMT
Here is how I am using it:

public class MyCollector extends PositiveScoresOnlyCollector  {

    private IndexReader indexReader;
         
   
    public MyCollector(IndexReader indexReader, PositiveScoresOnlyCollector
topScore) {
        super(topScore); 
        this.indexReader = indexReader;
      }

    @Override
    public void collect(int doc) {
        try {
                Document doc = indexReader.document(doc);
                //Custom Logic
                    super.collect(doc);
                
            
        } catch (Exception e) {
            
        }
    }



                MyCollector mycollector;
                TopScoreDocCollector topScore =
TopScoreDocCollector.create(100, true);
                IndexSearcher indexSearcher = new
IndexSearcher(indexReader);
                mycollector = new MyCollector(indexReader, new
PositiveScoresOnlyCollector(topScore));
                indexSearcher.search(queryString, (Filter) null,
mycollector);
                TopDocs hitDocs = topScore.topDocs();


Not sure what I am doing wrong here? How do I get a context to the
AtomicReader in my custom collector?

Thanks,
Sai



--
View this message in context: http://lucene.472066.n3.nabble.com/TopDocCollector-vs-TopScoreDocCollector-semantics-changed-in-4-0-not-backward-comptabile-tp4035806p4043502.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