You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/query-syntax.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,43 @@ Add `~N` to find words within N positions of each other:
40
40
"hello world"~2 // "hello" and "world" within 2 words of each other
41
41
```
42
42
43
+
## Fuzzy Search
44
+
45
+
Add `~` to a term to perform fuzzy matching based on edit distance (Levenshtein distance):
46
+
47
+
```
48
+
roam~ // Fuzzy search with default edit distance of 2
49
+
roam~1 // Fuzzy search with edit distance of 1
50
+
roam~0 // Exact match (edit distance of 0)
51
+
```
52
+
53
+
The edit distance specifies the maximum number of character changes (insertions, deletions, substitutions) allowed to match a term. For example, `roam~1` would match:
54
+
55
+
-`roam` (exact)
56
+
-`foam` (1 substitution)
57
+
-`roams` (1 insertion)
58
+
59
+
::: tip
60
+
Edit distance must be an integer. The default value is 2 when omitted. Lower values (0-1) are more restrictive and generally faster.
61
+
:::
62
+
63
+
::: info AST Representation
64
+
The AST preserves whether the fuzzy distance was explicitly specified:
65
+
-`term~` → `FuzzyDistance = TermNode.DefaultFuzzyDistance` (sentinel value -1)
0 commit comments