Commit 962369d
authored
fix: enable searching for literal reserved words (AND, OR, NOT) (#1103)
## Summary
- Fix issue 4 from KNOWN-ISSUES.md: users could not search for literal
words "AND", "OR", "NOT" even with quotes
- FTS5 reserved words are now properly escaped when generating FTS
queries
- Added examples to `km examples` showing how to search for literal
reserved words
## Changes
- **`src/Core/Search/NodeSearchService.cs`**: Added FTS5 reserved word
detection and escaping in `FtsQueryExtractor`
- **`src/Main/CLI/Commands/ExamplesCommand.cs`**: Added examples for
searching literal reserved words
- **`KNOWN-ISSUES.md`**: Removed resolved issue 4
- **`tests/Core.Tests/Search/FtsQueryExtractionTest.cs`**: Added 5 E2E
tests
- **`tests/Core.Tests/Search/Query/InfixQueryParserTests.cs`**: Added 12
parser tests
## Test plan
- [x] All 520 tests pass (306 Core + 214 Main)
- [x] Zero skipped tests
- [x] Code coverage at 83.82% (above 80% threshold)
- [x] `build.sh` passes with 0 warnings
- [x] `format.sh` passes
- [x] `coverage.sh` passes
## Usage examples (now working)
```bash
km search '"NOT"' # Search for literal "NOT"
km search '"AND"' # Search for literal "AND"
km search '"Alice AND Bob"' # Search for phrase containing AND
```1 parent b22235d commit 962369d
File tree
5 files changed
+478
-49
lines changed- src
- Core/Search
- Main/CLI/Commands
- tests/Core.Tests/Search
- Query
5 files changed
+478
-49
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | 87 | | |
115 | 88 | | |
116 | 89 | | |
| |||
127 | 100 | | |
128 | 101 | | |
129 | 102 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
130 | 139 | | |
131 | 140 | | |
132 | 141 | | |
| |||
153 | 162 | | |
154 | 163 | | |
155 | 164 | | |
156 | | - | |
| 165 | + | |
157 | 166 | | |
158 | 167 | | |
159 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
160 | 178 | | |
161 | | - | |
| 179 | + | |
162 | 180 | | |
163 | 181 | | |
164 | 182 | | |
165 | 183 | | |
166 | | - | |
| 184 | + | |
167 | 185 | | |
168 | 186 | | |
169 | 187 | | |
170 | 188 | | |
171 | | - | |
| 189 | + | |
172 | 190 | | |
173 | 191 | | |
174 | 192 | | |
| |||
208 | 226 | | |
209 | 227 | | |
210 | 228 | | |
211 | | - | |
| 229 | + | |
212 | 230 | | |
213 | 231 | | |
214 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
215 | 242 | | |
216 | | - | |
217 | | - | |
| 243 | + | |
| 244 | + | |
218 | 245 | | |
219 | 246 | | |
220 | 247 | | |
| |||
233 | 260 | | |
234 | 261 | | |
235 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
236 | 281 | | |
237 | 282 | | |
238 | 283 | | |
239 | 284 | | |
240 | 285 | | |
241 | | - | |
242 | | - | |
| 286 | + | |
| 287 | + | |
243 | 288 | | |
244 | 289 | | |
245 | 290 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
142 | 149 | | |
143 | 150 | | |
144 | 151 | | |
| |||
0 commit comments