lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ivan cruces <>
Subject Lucene pagination using searchAfter while index is updated
Date Fri, 17 Nov 2017 08:30:29 GMT

I have implemented pagination with Lucene using the searchAfter method
provided by IndexSearcher. In every call, I pass the last ScoreDoc returned
in the previous page.

The problem is that sometimes, the index gets updated between page and page
and occasionally I am getting this exception:

java.lang.IllegalArgumentException: after.doc exceeds the number of
documents in the reader: after.doc=337 limit=337

I understand that Lucene changes the docs ids every now and then (segment
merges, etc.) and I guess that is why that exception is happening as
searchAfter relies on those docs ids.

How could I improve this pagination mechanism to avoid this exception? Is
there any better way to implement pagination with Lucene?



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message