airborne12 opened a new pull request, #61599:
URL: https://github.com/apache/doris/pull/61599
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
The ANTLR lexer in the search() DSL parser excluded `/` from `TERM_CHAR`,
causing terms like `AC/DC` to be incorrectly tokenized. The slash was silently
skipped by ANTLR's default error recovery, splitting `AC/DC` into two separate
terms `AC` and `DC` instead of treating it as a single term.
This caused inconsistent behavior compared to Elasticsearch's query_string
parsing, where `AC\/DC` (escaped slash) is handled as a single analyzed term.
**Fix**: Add `/` to the `TERM_CHAR` fragment in `SearchLexer.g4`. This
allows `/` to appear within terms (e.g., `AC/DC` -> single term) while regex
patterns like `/[a-z]+/` still work correctly since `/` remains excluded from
`TERM_START_CHAR`.
### Release note
Fix search() function incorrectly handling slash (/) character within query
terms (e.g., `AC/DC`). The slash is now treated as a regular character within
terms instead of being silently dropped.
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [x] Regression test
- [x] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [x] Yes. <!-- Terms containing `/` (like `AC/DC`) are now parsed as
single terms instead of being split. This matches the expected behavior and is
consistent with escaped slash (`AC\/DC`) behavior. -->
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]