-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[feature](search) add phrase/wildcard/regex support for search and refact some code #57372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
|
run buildall |
zzzxl1993
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
PR approved by anyone and no changes requested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the search functionality by adding support for phrase queries, wildcard queries, and regex queries, while refactoring code to improve maintainability and ensure proper NULL semantics handling across all query types.
Key Changes
- Added phrase query support with proper tokenization and multi-term matching
- Implemented wildcard and regex query functionality with pattern matching
- Refactored NULL bitmap fetching into a centralized utility class to eliminate code duplication
- Enhanced field binding context propagation to support default field parameters
Reviewed Changes
Copilot reviewed 17 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| be/src/olap/rowset/segment_v2/inverted_index/query_v2/null_bitmap_fetcher.h | New utility class centralizing NULL bitmap fetching logic |
| be/src/vec/functions/function_search.cpp | Added phrase/wildcard/regex query implementations and field binding context propagation |
| be/src/olap/rowset/segment_v2/inverted_index/query_v2/term_query/term_query.h | Removed logical_field parameter, delegated to binding context |
| be/src/olap/rowset/segment_v2/inverted_index/query_v2/phrase_query/phrase_weight.h | Updated to use centralized NULL bitmap fetcher and proper BitSetScorer wrapping |
| be/src/olap/rowset/segment_v2/inverted_index/query_v2/regexp_query/regexp_weight.cpp | Updated to fetch NULL bitmap for proper NULL semantics |
| be/src/olap/rowset/segment_v2/inverted_index/query_v2/weight.h | Added FieldBindingContext structure and helper methods for field resolution |
| regression-test/suites/search/test_search_default_field_operator.groovy | Comprehensive test suite for default field and operator functionality |
| regression-test/suites/search/test_search_null_semantics.groovy | Added phrase NOT query test case |
| regression-test/data/search/*.out | Updated expected test outputs reflecting new query behaviors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Replace wildcard characters with regex equivalents | ||
| // * -> .* (zero or more of any character) | ||
| escaped = std::regex_replace(escaped, std::regex(R"(\\\*)"), ".*"); | ||
| // ? -> . (exactly one of any character) |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The comment format is inconsistent with typical C++ inline comment style. Consider consolidating related comments onto fewer lines for better readability. For example: // Replace wildcard characters: * -> .* (zero or more), ? -> . (exactly one)
| // Replace wildcard characters with regex equivalents | |
| // * -> .* (zero or more of any character) | |
| escaped = std::regex_replace(escaped, std::regex(R"(\\\*)"), ".*"); | |
| // ? -> . (exactly one of any character) | |
| // Replace wildcard characters: * -> .* (zero or more), ? -> . (exactly one) | |
| escaped = std::regex_replace(escaped, std::regex(R"(\\\*)"), ".*"); |
| // Small helper that centralizes "field NULL bitmap" lookups so weights/scorers | ||
| // don't have to duplicate resolver plumbing. |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The class documentation uses informal language ('Small helper'). Consider more professional phrasing such as: 'Utility class that centralizes field NULL bitmap lookups to avoid duplicating resolver logic across weights and scorers.'
| // Small helper that centralizes "field NULL bitmap" lookups so weights/scorers | |
| // don't have to duplicate resolver plumbing. | |
| // Utility class that centralizes field NULL bitmap lookups to avoid duplicating | |
| // resolver logic across weights and scorers. |
ClickBench: Total hot run time: 28.1 s |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
eldenmoon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
PR approved by at least one committer and no changes requested. |
…fact some code (apache#57372) Related PR: apache#57007 Problem Summary: This PR enhances the search functionality by adding support for phrase queries, wildcard queries, and regex queries, while refactoring code to improve maintainability and ensure proper NULL semantics handling across all query types.
…fact some code (apache#57372) Related PR: apache#57007 Problem Summary: This PR enhances the search functionality by adding support for phrase queries, wildcard queries, and regex queries, while refactoring code to improve maintainability and ensure proper NULL semantics handling across all query types.
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #57007
Problem Summary:
This PR enhances the search functionality by adding support for phrase queries, wildcard queries, and regex queries, while refactoring code to improve maintainability and ensure proper NULL semantics handling across all query types.
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)