Commit 468f944
authored
The getNonWildcardSequence method incorrectly handled cases where an
escaped backslash was followed by a wildcard character. It would check
if the character before a wildcard was a backslash, but didn't account
for that backslash itself being escaped.
For example, the query "*some\\*" (matching strings containing "some\")
would incorrectly return "some\\*" instead of "some\\", causing invalid
ngrams containing the wildcard character to be generated.
The fix counts consecutive backslashes before wildcards:
- Even count: wildcard is NOT escaped
- Odd count: wildcard IS escaped
---------
Signed-off-by: Deven Prajapati <pdevens09@gmail.com>
Signed-off-by: Deven009 <pdevens09@gmail.com>
Signed-off-by: Deven009 <37845204+Deven009@users.noreply.github.com>
1 parent 9ca9ee8 commit 468f944
File tree
3 files changed
+39
-2
lines changed- server/src
- main/java/org/opensearch/index/mapper
- test/java/org/opensearch/index/mapper
3 files changed
+39
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
| 508 | + | |
508 | 509 | | |
509 | 510 | | |
510 | | - | |
511 | | - | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
512 | 518 | | |
513 | 519 | | |
514 | 520 | | |
| |||
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
145 | 175 | | |
146 | 176 | | |
147 | 177 | | |
| |||
0 commit comments