feat: add Hebrew proximity wildcard search - #521
Open
david-hoze wants to merge 4 commits into
Open
Conversation
- Strip Hebrew nikud (U+0591-U+05C7) and optional Arabic harakat in removeDiacritics - Use query terms for highlighting instead of MiniSearch result.terms (avoids fuzzy false highlights) - Disable fuzziness for terms length <= 4 to avoid e.g. ׳×׳§׳™׳© matching ׳×׳§׳•׳� - When ignore diacritics: match on original text with optional-diacritics regex so highlight indices and spans are correct (was using normalized-text indices on original, causing wrong highlights) Co-authored-by: Cursor <cursoragent@cursor.com>
…in diacritics regex Co-authored-by: Cursor <cursoragent@cursor.com>
New search syntax finds Hebrew words matching wildcard patterns within N words of each other. Supports star and plus wildcards, final-form interchangeability, and nikud stripping. Bypasses MiniSearch for proximity queries to handle Hebrew prefix letters correctly. Accepts both LTR and RTL input forms, and optional N defaults to 10. Co-authored-by: Cursor <cursoragent@cursor.com>
Wildcards at leading/trailing positions (e.g. +׳©׳�׳�+) only apply at the edges. Only wildcards between the first and last Hebrew letter trigger middle expansion between all letter pairs (e.g. +׳©+׳�׳�+). Updated tests to verify both behaviors. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
@N(pattern1 pattern2 ...)search syntax that finds Hebrew words matching wildcard patterns within N words of each other (N is optional, defaults to 10)*(any Hebrew letter),+(prefix/suffix letter set), final-form interchangeability (e.g. מ/ם, נ/ן), and automatic nikud stripping@10(תקון)) and RTL ()10(תקון@) input formsFiles changed
src/search/proximity-search.tssrc/search/query.ts@N(...)syntax early in the Query constructor, store parsed ProximityQuery, populate root terms for downstream usesrc/search/search-engine.tsgetProximitySuggestions()that scans all indexed documents with proximity matching, called fromgetSuggestions()when a proximity query is detectedsrc/__tests__/proximity-search-tests.tsTest plan
@10(תקון)— should return notes containing the Hebrew word תקון (and variants like תִּקּוּן with nikud)@10(+ת*ק*ן+ +ש+למ+ מאד)— should find documents where all three patterns appear within 10 Hebrew words of each other@(+תקן+)(no distance number) — should default to distance 10)10(תקון@— should be recognized and work identically