airborne12 opened a new pull request, #69052:
URL: https://github.com/apache/doris/pull/69052
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: Regexp and wildcard clauses in `search()` return a constant
`score()` of 1 for every matching document. `RegexpWeight` unions the expanded
terms into a document bitmap and wraps it in `ConstScoreScorer`;
`WildcardWeight` delegates to the same path. When scoring is enabled, this
change creates a BM25 term scorer for each expanded term using reader
statistics and sums the scores of terms matching the same document. Queries
without scoring retain the bitmap path. New BE tests with repeated and multiple
matching terms failed with constant scores before the fix and pass afterward.
### Release note
`search()` now returns relevance scores for regexp and wildcard clauses on
inverted indexes.
### Check List (For Author)
- Test
- [ ] Regression test
- [x] Unit Test: `GLIBC_COMPATIBILITY=OFF ./run-be-ut.sh --run
--filter=RegexpQueryV2Test.*:WildcardQueryV2Test.*:RegexpWildcardLowercaseTest.*
-j 8` (36 passed).
- [ ] Manual test
- [ ] No need to test or manual test.
- Style: `clang-format.sh`, `check-format.sh`, `check-build-hygiene.sh`, and
`git diff --check` passed. Clang-tidy reports existing diagnostics in
`core/types.h` and `collect_matching_terms`; it reports no diagnostic in the
new scoring function.
- Behavior changed:
- [ ] No.
- [x] Yes. Regexp and wildcard `search()` clauses produce term-based
scores instead of constant scores when scoring is requested.
- 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]