Skip to content

[fix](search) Validate mode parameter in search() DSL options#60785

Open
airborne12 wants to merge 1 commit intoapache:masterfrom
airborne12:fix-invalid-search-mode-error
Open

[fix](search) Validate mode parameter in search() DSL options#60785
airborne12 wants to merge 1 commit intoapache:masterfrom
airborne12:fix-invalid-search-mode-error

Conversation

@airborne12
Copy link
Member

What problem does this PR solve?

Issue Number: close #DORIS-24352

Problem Summary:
When using search() with an invalid mode value in the options JSON (e.g., "mode":"lucenedfafa"), the query silently falls back to standard mode instead of reporting an error. This makes it difficult for users to detect typos or misconfiguration.

This PR adds validation in SearchOptions.validate() to reject any mode value other than "standard" or "lucene", throwing a clear error message.

Release note

Fix search() DSL to report an error when an invalid mode value is specified instead of silently falling back to standard mode.

Check List (For Author)

  • Test

    • 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:

    • Yes. Previously, invalid mode values were silently accepted and treated as "standard" mode. Now they throw an IllegalArgumentException with a descriptive message.
  • Does this need documentation?

    • No.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

Invalid mode values (e.g. "lucenedfafa") were silently accepted and
fell back to standard mode. Now rejects invalid modes with a clear
error message listing the valid values: "standard" and "lucene".
@Thearas
Copy link
Contributor

Thearas commented Feb 18, 2026

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?

@airborne12
Copy link
Member Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 28691 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 95597a997bf1090209e8502b934d605b1541bc96, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17614	4410	4263	4263
q2	q3	10683	779	521	521
q4	4700	372	258	258
q5	7554	1195	1035	1035
q6	173	177	146	146
q7	796	829	667	667
q8	9286	1477	1298	1298
q9	4850	4806	4690	4690
q10	6821	1871	1627	1627
q11	480	271	238	238
q12	680	568	474	474
q13	17790	4276	3405	3405
q14	233	233	222	222
q15	976	793	785	785
q16	752	731	670	670
q17	712	874	466	466
q18	5957	5396	5246	5246
q19	1245	965	619	619
q20	507	496	390	390
q21	4669	1853	1421	1421
q22	341	285	250	250
Total cold run time: 96819 ms
Total hot run time: 28691 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4363	4327	4340	4327
q2	q3	1760	2162	1732	1732
q4	887	1162	768	768
q5	4020	4337	4285	4285
q6	179	171	142	142
q7	1722	1603	1476	1476
q8	2419	2655	2501	2501
q9	7484	7439	7418	7418
q10	2637	2892	2437	2437
q11	503	430	410	410
q12	502	611	478	478
q13	4055	4439	3647	3647
q14	301	308	289	289
q15	853	800	876	800
q16	719	755	740	740
q17	1175	1520	1311	1311
q18	7170	6790	6710	6710
q19	915	927	909	909
q20	2096	2156	2041	2041
q21	4055	3485	3395	3395
q22	517	480	423	423
Total cold run time: 48332 ms
Total hot run time: 46239 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 183967 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 95597a997bf1090209e8502b934d605b1541bc96, data reload: false

query5	4808	642	522	522
query6	332	210	191	191
query7	4229	456	279	279
query8	331	235	250	235
query9	8775	2756	2724	2724
query10	514	370	333	333
query11	17022	17474	17426	17426
query12	235	182	130	130
query13	1324	465	368	368
query14	7141	3256	3094	3094
query14_1	2950	2985	2893	2893
query15	208	196	175	175
query16	990	489	488	488
query17	1550	796	658	658
query18	2950	471	423	423
query19	229	229	190	190
query20	139	133	136	133
query21	244	146	122	122
query22	5341	5076	4719	4719
query23	17217	16924	16681	16681
query23_1	16759	16636	16649	16636
query24	7146	1630	1209	1209
query24_1	1224	1245	1229	1229
query25	558	490	435	435
query26	1230	263	152	152
query27	2781	470	286	286
query28	4504	1876	1892	1876
query29	823	587	494	494
query30	311	247	208	208
query31	862	742	638	638
query32	84	74	76	74
query33	528	351	302	302
query34	903	924	556	556
query35	641	700	599	599
query36	1097	1140	998	998
query37	132	100	92	92
query38	2977	2921	2844	2844
query39	878	857	846	846
query39_1	827	817	811	811
query40	237	156	142	142
query41	66	66	64	64
query42	109	104	101	101
query43	375	383	347	347
query44	
query45	206	193	183	183
query46	883	981	612	612
query47	2180	2158	2058	2058
query48	310	312	244	244
query49	639	484	412	412
query50	677	290	218	218
query51	4102	4157	4054	4054
query52	108	107	93	93
query53	285	338	278	278
query54	293	266	252	252
query55	87	81	85	81
query56	313	304	310	304
query57	1363	1359	1276	1276
query58	291	273	266	266
query59	2629	2643	2574	2574
query60	344	335	315	315
query61	151	147	146	146
query62	623	581	523	523
query63	313	281	273	273
query64	4881	1326	1006	1006
query65	
query66	1383	451	353	353
query67	16384	16401	16261	16261
query68	
query69	404	309	281	281
query70	1010	975	974	974
query71	335	304	298	298
query72	2803	2674	2389	2389
query73	534	547	325	325
query74	9981	9958	9788	9788
query75	2852	2729	2461	2461
query76	2324	1038	669	669
query77	371	367	302	302
query78	11233	11443	10693	10693
query79	1147	793	618	618
query80	1357	620	527	527
query81	568	271	256	256
query82	1000	153	112	112
query83	348	261	249	249
query84	252	112	97	97
query85	900	473	431	431
query86	420	325	286	286
query87	3118	3118	3021	3021
query88	3536	2684	2660	2660
query89	417	373	338	338
query90	2031	178	162	162
query91	172	160	132	132
query92	79	75	73	73
query93	993	850	513	513
query94	632	343	305	305
query95	589	393	317	317
query96	637	515	228	228
query97	2451	2521	2426	2426
query98	235	214	223	214
query99	1022	1034	942	942
Total cold run time: 255126 ms
Total hot run time: 183967 ms

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 25.00% (1/4) 🎉
Increment coverage report
Complete coverage report

1 similar comment
@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 25.00% (1/4) 🎉
Increment coverage report
Complete coverage report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments