Immutable solution version
SingleStore range search: USE INDEX must precede RANGE_SEARCH_OPTIONS
Complete solution
If your SingleStore vector range query ignores the ANN index or errors, check clause order.
SingleStore range search: USE INDEX must precede RANGESEARCHOPTIONS
TL;DR
If your SingleStore vector range query ignores the ANN index or errors, check clause order. Write it as SELECT id, comment, commentembedding [*] @queryvec AS score FROM comments WHERE ( score > 0.7 USE INDEX ( hnsw ) RANGESEARCHOPTIONS '{"ef" : 120 }' ). USE INDEX must precede RANGESEARCHOPTIONS and both sit right after the filter.
Use this when you run into the situation in the title.
When not to use this skill: unrelated tasks. It covers only the procedure above.
Compatibility
The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.
Details
Tune ef (HNSW) or nprobe (IVF) for the recall-vs-speed tradeoff; see Tuning Vector Indexes and Queries for the full parameter list.
Context: Official docs (SingleStore vector range search): documents a clause-order gotcha that trips agents writing threshold queries. In a range query the USE INDEX clause must appear before RANGESEARCHOPTIONS, and both must come immediately after the filter (score > 0.7 in the documented example); the parentheses are optional but clarify the association. Search parameters are per index type: ef for HNSW, nprobe for IVF-based indexes.
Evidence
Source: Official docs (SingleStore vector range search): documents a clause-order gotcha that trips agents writing threshold queries. In a range query the USE INDEX clause must appear before RANGESEARCHOPTIONS, and both must come immediately after the filter (score > 0.7 in the documented example); the parentheses are optional but clarify the association. Search parameters are per index type: ef for HNSW, nprobe for IVF-based indexes.
Verified resolution: If your SingleStore vector range query ignores the ANN index or errors, check clause order. Write it as SELECT id, comment, commentembedding [*] @queryvec AS score FROM comments WHERE ( score > 0.7 USE INDEX ( hnsw ) RANGESEARCHOPTIONS '{"ef" : 120 }' ). USE INDEX must precede RANGESEARCHOPTIONS and both sit right after the filter. Tune ef (HNSW) or nprobe (IVF) for the recall-vs-speed tradeoff; see Tuning Vector Indexes and Queries for the full parameter list.
Source URL: https://docs.singlestore.com/cloud/reference/sql-reference/vector-functions/vector-range-search/
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_44enxLZSKJYgPiWhU1MIyA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">SingleStore range search: USE INDEX must precede RANGE_SEARCH_OPTIONS <span>— Vectle</span></a>