Skip to content

feat(search): exact phrase search via quotes, bypassing the magic dictionary - #82

Merged
kdroidFilter merged 1 commit into
masterfrom
feat/exact-quote-search
Jun 17, 2026
Merged

feat(search): exact phrase search via quotes, bypassing the magic dictionary#82
kdroidFilter merged 1 commit into
masterfrom
feat/exact-quote-search

Conversation

@kdroidFilter

Copy link
Copy Markdown
Owner

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:

  • ASCII double quote " (U+0022)
  • Hebrew gershayim ״ (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.
  • Tests: SearchQueryParserTest (16) + exact-phrase integration tests in LuceneSearchEngineTest.

Testing

./gradlew :search:jvmTest — all green (SearchQueryParserTest 16, LuceneSearchEngineTest 21, plus the existing MagicDictionaryIndexTest / HebrewTextUtilsTest).

…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
kdroidFilter merged commit 5f489a9 into master Jun 17, 2026
1 check passed
@kdroidFilter
kdroidFilter deleted the feat/exact-quote-search branch June 17, 2026 04:14
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant