Commit dc3e418
Strip MySQL fulltext boolean mode operators from search terms
Search terms are passed into a MySQL `MATCH(...) AGAINST(? IN BOOLEAN
MODE)` query. In boolean mode MySQL has its own mini-syntax with the
operators `+ - > < ( ) ~ * " @`. When user input contains one of these
(for example the `@` proximity operator in a string like `icu4c@78`),
MySQL's fulltext parser throws a 1064 syntax error instead of treating
the input as data.
`escapeSearchTerm()` only stripped `" * ( ) :`, leaving `@ + - ~ < >`
intact. Add the remaining operators, and replace stripped operators with
a space rather than removing them so each side becomes its own search
term (every driver already splits the escaped term on whitespace before
building its query).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 9bbee80 commit dc3e418
2 files changed
Lines changed: 24 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
22 | 20 | | |
23 | 21 | | |
24 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
13 | 31 | | |
14 | 32 | | |
15 | 33 | | |
| |||
0 commit comments