Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lowercase search term tokens #117

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public byte[] bytes() {
}
final BloomFilter filter = BloomFilter.create(expected, fpp);
for (final String token : stringTokens) {
filter.put(token);
filter.put(token.toLowerCase());
}
try (final ByteArrayOutputStream filterBAOS = new ByteArrayOutputStream()) {
filter.writeTo(filterBAOS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void testRegexExtractedTokens() {
byte[] bytes = Assertions.assertDoesNotThrow(filter::bytes);
BloomFilter resultFilter = Assertions
.assertDoesNotThrow(() -> BloomFilter.readFrom(new ByteArrayInputStream(bytes)));
Assertions.assertTrue(resultFilter.mightContain("Pattern"));
Assertions.assertTrue(resultFilter.mightContain("pattern"));
}

@Test
Expand All @@ -110,9 +110,10 @@ public void testTokenizerTokens() {
byte[] bytes = Assertions.assertDoesNotThrow(filter::bytes);
BloomFilter resultFilter = Assertions
.assertDoesNotThrow(() -> BloomFilter.readFrom(new ByteArrayInputStream(bytes)));
Assertions.assertFalse(resultFilter.mightContain("Pattern"));
Assertions.assertTrue(resultFilter.mightContain("Without"));
Assertions.assertTrue(resultFilter.mightContain("SearchValuePatternInThisString"));
// test that tokens present and in lower case
Assertions.assertFalse(resultFilter.mightContain("pattern"));
Assertions.assertTrue(resultFilter.mightContain("without"));
Assertions.assertTrue(resultFilter.mightContain("searchvaluepatterninthisstring"));
}

@Test
Expand Down