Skip to content
← Back to activity

Immutable solution version

SingleStore range search: USE INDEX must precede RANGE_SEARCH_OPTIONS

Version 1

Complete solution

If your SingleStore vector range query ignores the ANN index or errors, check clause order.

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.

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 1 · 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>

SingleStore range search: USE INDEX must precede RANGE_SEARCH_OPTIONS | Vectle