Skip to content

Conversation

@github-actions
Copy link
Contributor

Cherry-picked from #57312

### What problem does this PR solve?

Problem Summary:

* Extend `search()` to accept **1–3 arguments**:

  1. `query`: the original search DSL string (unchanged).
2. `default_field` *(optional)*: field name applied to unqualified terms
in `query`.
3. `default_operator` *(optional)*: boolean operator for multi-term
queries; accepts `"and"` or `"or"` (case-insensitive).

  * If omitted or empty, the operator defaults to **`or`**.
* Parser updates:

* When `default_field` is provided, unqualified terms in `query` are
automatically rewritten to `default_field:term`.
* `default_operator` is validated and normalized; invalid values produce
a clear error.

### Example

**Before** (must qualify every term or rely on engine defaulting rules):

```sql
SELECT *
FROM t
WHERE search('title:payment title:timeout')
```

**After** (use `default_field = "title"` and `default_operator =
"and"`):

```sql
SELECT *
FROM t
WHERE search('payment timeout', 'title', 'and');
```

This evaluates as if the query were `title:payment AND title:timeout`.
@github-actions github-actions bot requested a review from yiguolei as a code owner October 25, 2025 11:48
@hello-stephen
Copy link
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@dataroaring dataroaring reopened this Oct 25, 2025
@hello-stephen
Copy link
Contributor

run buildall

@doris-robot
Copy link

ClickBench: Total hot run time: 30.46 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 9fb2963039f3fd4e5825486a9023d2055c505dfd, data reload: true

query1	0.04	0.03	0.03
query2	0.11	0.04	0.04
query3	0.27	0.08	0.07
query4	1.63	0.12	0.11
query5	0.29	0.26	0.24
query6	1.22	0.66	0.64
query7	0.03	0.02	0.02
query8	0.06	0.03	0.04
query9	0.62	0.52	0.53
query10	0.57	0.56	0.56
query11	0.17	0.11	0.11
query12	0.15	0.12	0.12
query13	0.63	0.61	0.62
query14	0.81	0.83	0.83
query15	0.88	0.86	0.86
query16	0.38	0.40	0.40
query17	1.03	1.06	1.06
query18	0.19	0.19	0.19
query19	1.95	1.89	1.87
query20	0.02	0.01	0.01
query21	15.40	0.91	0.57
query22	0.77	1.40	0.76
query23	14.88	1.37	0.63
query24	16.26	0.62	0.31
query25	0.18	0.13	0.09
query26	0.44	0.17	0.13
query27	0.06	0.06	0.05
query28	8.17	0.99	0.93
query29	12.60	3.94	3.31
query30	0.29	0.13	0.10
query31	2.88	0.59	0.39
query32	3.24	0.57	0.49
query33	3.03	3.35	3.41
query34	17.05	5.82	5.02
query35	5.15	5.12	5.11
query36	0.73	0.56	0.53
query37	0.10	0.07	0.07
query38	0.06	0.05	0.05
query39	0.04	0.02	0.03
query40	0.17	0.15	0.15
query41	0.08	0.03	0.03
query42	0.04	0.03	0.02
query43	0.03	0.03	0.04
Total cold run time: 112.7 s
Total hot run time: 30.46 s

@github-actions
Copy link
Contributor Author

PR approved by at least one committer and no changes requested.

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Oct 26, 2025
@github-actions
Copy link
Contributor Author

PR approved by anyone and no changes requested.

@yiguolei yiguolei merged commit 3099d13 into branch-4.0 Oct 26, 2025
25 of 27 checks passed
@github-actions github-actions bot deleted the auto-pick-57312-branch-4.0 branch October 26, 2025 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants