soma0212 opened a new pull request, #16853:
URL: https://github.com/apache/lucene/pull/16853
### Description
`EscapeQuerySyntaxImpl.escapeIgnoringCase` (flexible query parser) looks for
syntax characters in a lower-cased copy of the term text, then inserts the
backslashes at those indexes in the original text. Lower-casing can change the
length: U+0130 (capital I with dot above) becomes two chars in every non-Turkic
locale, so each syntax character after it is escaped one position too far
right, and a syntax character in last position throws
`IndexOutOfBoundsException`. For a quoted term this closes the phrase early:
`new QuotedFieldQueryNode("body", "İ\" OR secret:\"x", 0,
0).toQueryString(escaper)` gives `body:"İ"\ OR secret:"\x"`, which the parser
reads as a phrase plus a separate `secret:` clause, so `toQueryString` output
no longer parses back to the original node (the same round trip #7865 fixed for
range nodes).
Match and copy from the same string, using `String.regionMatches(true,
...)`, which keeps the case-insensitive contract without changing length. The
`Locale` parameter of the private helper is unused after that and is dropped.
`TestEscapeQuerySyntaxImpl` covers the escape positions and the parse-back;
both tests fail on main. I can add a CHANGES entry under 10.7.0 once this has a
PR number.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]