"terms expansion" meaning

/* Thu May 22 16:15:03.324 2025 conn 50380669 (10.0.7.70:35442) real 0.008 wall 0.009 found 0 / SELECT * FROM employees_index WHERE MATCH('(@ “daria”) @account_id = 1857’) LIMIT 10000 OPTION max_matches=2000, ranker=fieldmask; /*terms expansion=(merged 6841, not merged 4) */

/* Thu May 22 19:17:25.328 2025 conn 50500850 (127.0.0.1:39104) real 3.343 wall 3.344 found 1 / SELECT * FROM employees_index WHERE MATCH('(@ “daria”) @account_id = 1857’) LIMIT 10000 OPTION max_matches=2000, ranker=fieldmask; /*terms expansion=(merged 6767, not merged 4) */

What does the “term expansion” mean at the end of the queries above?

that shows how many expanded terms passed the thresholds expansion_merge_threshold_docs and expansion_merge_threshold_hits Server settings > Searchd | Manticore Search Manual

However not sure why it showed for these queries as I see not wildcards there. Maybe you use expand_keywords index option that add such transformation.

1 Like

Actually, there is a wildcard star (*) after the @ symbol inside the match(). it’s being removed by the formatting here.

would that affect the returned results? as you can see, first query returned zero match while returning one match on the second query but they are the same query.

/* Thu May 22 19:17:25.328 2025 conn 50500850 (127.0.0.1:39104) real 3.343 wall 3.344 found 1 */ SELECT * FROM employees_index WHERE MATCH('(@* “daria”) @account_id = 1857’) LIMIT 10000 OPTION max_matches=2000, ranker=fieldmask; /*terms expansion=(merged 6767, not merged 4) */

yes, expand_keywords is enabled for this index