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

   ### What problem does this PR solve?
   
   Related PR: #60782
   
   Problem Summary:
   When `search()` DSL uses wildcard patterns (e.g. `*ith`, `sm*th`, `sm?th`) 
on variant subcolumns with analyzer-based indexes (field_pattern), the queries 
return empty results even though regular TERM search works correctly.
   
   **Root cause:** In `FieldReaderResolver::resolve()`, only `EQUAL_QUERY` was 
upgraded to `MATCH_ANY_QUERY` for variant subcolumns with analyzer-based 
indexes. `WILDCARD_QUERY` was not upgraded, so `select_best_reader()` picked 
the `STRING_TYPE` reader instead of `FULLTEXT`. `WildcardWeight` then 
enumerated terms from the wrong (untokenized) index directory, finding no 
matches.
   
   **Fix:** Extend the query type upgrade condition to also cover 
`WILDCARD_QUERY`, so wildcard patterns correctly use the FULLTEXT index on 
variant subcolumns. Also fix a misleading comment in 
`inverted_index_iterator.cpp` where `is_equal_query()` was described as 
handling WILDCARD/REGEXP but actually only checks `EQUAL_QUERY`.
   
   ### Release note
   
   Fix wildcard search queries (`*`, `?` patterns) on variant subcolumns 
returning empty results when using Lucene-mode `search()` function.
   
   ### Check List (For Author)
   
   - Test
       - [x] Regression test
       - [ ] 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
   
   - Behavior changed:
       - [x] Yes. Wildcard queries on variant subcolumns now correctly return 
matching results instead of empty results.
   
   - Does this need documentation?
       - [x] No.
   
   ### 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