feat(search): exact phrase search via quotes, bypassing the magic dictionary - #82
Merged
Merged
Conversation
…tionary Text wrapped in double quotes is matched verbatim (Google-style): an exact, in-order, adjacent phrase with no magic-dictionary/synonym expansion, no fuzzy matching and no n-gram substring matching. Nikud and final letters are still normalized. Both delimiters are supported and interchangeable: ASCII double quote (U+0022) and Hebrew gershayim (U+05F4). A quote flanked by Hebrew letters on both sides is treated as an acronym (rashei tevot such as RaSHI, RaMBaM, ShUlchan Aruch) and is left untouched, so acronym searches keep working. Free (unquoted) terms still go through the dictionary pipeline and can be mixed with quoted phrases. - Add SearchQueryParser: acronym-safe splitting of quoted phrases vs free text - LuceneSearchEngine: strict slop-0 phrase queries for quoted segments; verbatim, non-expanded highlight/snippet terms - Tests: SearchQueryParserTest (16) + exact-phrase integration tests in LuceneSearchEngineTest
kdroidFilter
added a commit
to kdroidFilter/Zayit
that referenced
this pull request
Jun 17, 2026
) Updates the SeforimLibrary submodule (a73863b -> ce20610) to pull in Google-style exact-phrase search: double-quoted text is matched verbatim, bypassing the magic dictionary. See kdroidFilter/SeforimLibrary#82.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Google-style exact-phrase search. Text wrapped in double quotes is matched verbatim — an exact, in-order, adjacent phrase — with no magic-dictionary / synonym expansion, no fuzzy matching and no n-gram substring matching. Nikud and final letters are still normalized so the phrase matches the indexed form.
Delimiters
Both are supported and interchangeable, so it works whatever the keyboard produces:
"(U+0022)״(U+05F4)A double quote acts as a delimiter only at a word boundary. A quote flanked by Hebrew letters on both sides is an acronym (רש״י / רש"י, רמב״ם, שו״ע, תנ״ך, תשפ״א) and is left untouched, so acronym searches keep working exactly as before.
Mixing
Free (unquoted) terms keep the full dictionary pipeline and can be mixed with quoted phrases, e.g.
ירושלים "מלך דוד"requires the word ירושלים (with synonyms) and the exact phrase מלך דוד.Changes
SearchQueryParser(new): acronym-safe splitting of quoted phrases vs free text.LuceneSearchEngine: strict slop-0 phrase queries (MUST) for quoted segments; verbatim, non-expanded highlight/snippet terms; the free-text pipeline is unchanged.SearchQueryParserTest(16) + exact-phrase integration tests inLuceneSearchEngineTest.Testing
./gradlew :search:jvmTest— all green (SearchQueryParserTest 16, LuceneSearchEngineTest 21, plus the existing MagicDictionaryIndexTest / HebrewTextUtilsTest).