snoopdave commented on code in PR #226:
URL: https://github.com/apache/roller/pull/226#discussion_r4394483464
##########
app/src/main/java/org/apache/roller/weblogger/business/search/lucene/LuceneIndexManager.java:
##########
@@ -466,8 +466,10 @@ static SearchResultList convertHitsToEntryList(
// maybe null if search result returned inactive user
// or entry's user is not the requested user.
- // but don't return future posts
- if (entry != null && entry.getPubTime().before(now)) {
+ // The index can lag behind the entry, so return only entries
+ // that are published now, and not future posts
+ if (entry != null && entry.isPublished()
Review Comment:
🐞Codex Issue: **Important:** Filter unpublished entries before applying the
page window.
`offset` and `limit` are calculated from the raw Lucene hits above, so a
stale document rejected here still consumes a result slot. If the first page
contains matching entries returned to draft, search can return an empty page
even though matching published entries follow. I reproduced this against this
head on JDK 11 with the real database and index: index two matching published
entries, return the newest to draft without deleting its index document, then
search with page size 1. Page 0 returns 0 entries; page 1 returns the remaining
published entry.
Apply pagination to the eligible published entries, or keep scanning hits
until the visible page is filled while preserving the database publication
check. Please add a regression case with a draft hit ahead of a published hit;
the current single-entry draft test misses this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]