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: [email protected]
For additional commands, e-mail: [email protected]