Here is the way I implemented a collector class. Appreciate if you could let
me know of any issues..
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 {
//Custom Logic
super.collect(doc);
}
} catch (Exception e) {
}
}
//Usage:
MyCollector collector;
TopScoreDocCollector topScore =
TopScoreDocCollector.create(hits, true);
IndexSearcher searcher = new IndexSearcher(reader);
try {
collector = new MyCollector(indexReader, new
PositiveScoresOnlyCollector(topScore));
searcher.search(query, (Filter) null, collector);
} finally {
}
--
View this message in context:
http://lucene.472066.n3.nabble.com/TopDocCollector-vs-TopScoreDocCollector-semantics-changed-in-4-0-not-backward-comptabile-tp4035806p4035870.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]