I would like to write a custom collector ( similar to the one which is inside the source of TopScoreDocCollector like InOrderTopScoreDocCollector). The reason for extending this is because InOrderTopScoreDocCollector and OutOfOrderTopScoreDocCollector are private to the class and I really wanted to override the collect(int doc) method to have some custom logic incorporated. Could someone please let me know if this approach would work fine? or does have any issues?
Here is what I am thinking: public class MyCollector extends TopScoreDocCollector { public MyCollector (int numHits) { super(numHits); } @Override public void collect(int doc) throws IOException { float score = scorer.score(); // Add a check here if(score < 0.0f) { return; } // remaining code } @Override public boolean acceptsDocsOutOfOrder() { return true; } } -- View this message in context: http://lucene.472066.n3.nabble.com/Extending-TopScoreDocCollector-to-write-a-custom-collector-tp4035861.html Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org