airborne12 opened a new pull request, #60782:
URL: https://github.com/apache/doris/pull/60782

   ### What problem does this PR solve?
   
   Issue Number: close #xxx
   
   Related PR: #60654
   
   Problem Summary:
   
   Follow-up fix for #60654 (SearchDslParser refactoring).
   
   When FE resolves a variant subcolumn field pattern to a specific 
analyzer-based index and sends its `index_properties` via 
`TSearchFieldBinding`, the BE `FieldReaderResolver` was using `EQUAL_QUERY` for 
TERM clauses. This caused `select_best_reader` to pick the `STRING_TYPE` reader 
(untokenized index directory) instead of the `FULLTEXT` reader, so tokenized 
search terms would never match.
   
   **Root cause**: For variant subcolumns with analyzer-based indexes, 
`EQUAL_QUERY` opens the wrong (untokenized) index directory. The query type 
needs to be upgraded to `MATCH_ANY_QUERY` so `select_best_reader` picks the 
correct FULLTEXT reader.
   
   **Fix**: In `FieldReaderResolver::resolve()`, when the field is a variant 
subcolumn and the FE-provided `index_properties` indicate an analyzer-based 
index (`should_analyzer()` returns true), automatically upgrade `EQUAL_QUERY` 
to `MATCH_ANY_QUERY` before calling `select_best_reader`. Also reuse the 
`fb_it` iterator to avoid a redundant map lookup.
   
   ### Release note
   
   Fix variant subcolumn search queries to correctly select the FULLTEXT 
inverted index reader when an analyzer-based index is configured, instead of 
incorrectly using the untokenized STRING_TYPE reader.
   
   ### Check List (For Author)
   
   - Test
       - [ ] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [x] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [x] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason
   
   - Behavior changed:
       - [x] Yes. Variant subcolumn TERM queries now correctly use the FULLTEXT 
reader when the index has an analyzer configured, matching the expected 
ES-compatible behavior.
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label


-- 
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]

Reply via email to