Sorry, searchAfter only works if you are sorting by score or by fields. It seems like you are sorting by docID? Ie, at first you want the top 100 hits sorted by docID, then the next 100, etc.?
If so, you could just modify your collector so that you tell it up front the "afterDocID" (= last docID from the previous page), and in your collect method, if the docID is <= afterDocID, don't collect it, and then if the number of hits collected == 100, throw a custom exception to abort the search? That will do the same thing that searchAfter does for "normal" sorting. Mike McCandless http://blog.mikemccandless.com On Mon, Feb 17, 2014 at 7:05 PM, saisantoshi <saisantosh...@gmail.com> wrote: > As I mentioned in my original post, I am calling like the below: > > MyCollector collector; > TopScoreDocCollector topScore = > TopScoreDocCollector.create(firstIndex+numHits, true); > IndexSearcher searcher = new IndexSearcher(reader); > try { > collector = new MyCollector(indexReader, new > PositiveScoresOnlyCollector(topScore)); > searcher.search(query, (Filter) null, collector); > } finally { > > } > > The searchAfter method does not take any collector. I want the > collector.collect(int doc) to be called only for the next set and not from > the starting. If a request comes for the first set, it would be like: > > TopScoreDocCollector topScore = TopScoreDocCollector.create(0+100, true); > > the collector should call only 1- 100 and for the next set > > TopScoreDocCollector topScore = TopScoreDocCollector.create(101+100, true); > > it should call from 101 - 200 and not from 0-200. > > Thanks, > Sai. > > > > > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Collector-is-collecting-more-than-the-specified-hits-tp4117329p4117901.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 > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org