Skip to content

Conversation

@jjezra
Copy link
Contributor

@jjezra jjezra commented Oct 21, 2025

Add support for index filters by predicates or by IndexMaintenanceFilter.
However, Lucene can only support ALL or NONE. Filtering SOME will cause an exception.

Resolves #3065

@jjezra jjezra added the bug fix Change that fixes a bug label Oct 22, 2025
@jjezra jjezra requested a review from ohadzeliger October 22, 2025 16:14
@jjezra jjezra marked this pull request as ready for review October 22, 2025 16:26
@jjezra jjezra requested a review from ScottDugas October 24, 2025 15:49
assertNotEquals(needMerge, filterOut);
}

private TestRecordsTextProto.MapDocument multiEntryMapDoc(long id, String text, int group) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a test that fails:

  • filter returns SOME
  • filter throws exception

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jjezra jjezra requested a review from ohadzeliger October 27, 2025 16:14
Copy link
Collaborator

@ScottDugas ScottDugas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can discuss offline about the coupling between the test and LuceneIndexTestDataModel, I clearly had a vision for that that did not come through in the comments/code.

@jjezra jjezra requested a review from ScottDugas November 6, 2025 23:36
Comment on lines 261 to 273
try (FDBRecordContext context = openContext()) {
// overwrite records
dataModel.saveRecords(10, context, 2);
commit(context);
}

try (FDBRecordContext context = openContext()) {
// The same filter should apply to index scrubbing - else "missing" index entries will be detected
final long missingIndexEntries = dataModel.findMissingIndexEntries(context, null);
assertEquals(0, missingIndexEntries);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test now seems even further from testing the scan functionality.
If you put the filter somewhere shareable, it should be pretty easy to put the testing of scrubbing in LuceneIndexScrubbingTest, and putting this others in LuceneIndexMaintenanceTest which feels appropriate to me. Although, maybe it would be best to just have a new class for filtered lucene indexes.

Perhaps not the highest priority though.

@jjezra jjezra requested a review from ScottDugas November 7, 2025 21:04
@jjezra jjezra requested a review from ScottDugas November 7, 2025 22:13
@jjezra jjezra force-pushed the lucene_filter_records branch from c294935 to 6746ecb Compare November 10, 2025 19:37
@jjezra
Copy link
Contributor Author

jjezra commented Nov 10, 2025

Rebase to "fix" line numbers and see if it affects Teamscale's Test Gaps.

@ScottDugas ScottDugas merged commit bb93d20 into FoundationDB:main Nov 10, 2025
8 checks passed
@jjezra jjezra deleted the lucene_filter_records branch November 11, 2025 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix Change that fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lucene should support index filters

3 participants