This section documents search capabilities in Spice SQL, including vector search, full-text search, and lexical filtering methods. These features help retrieve relevant data using semantic similarity, keyword matching, and pattern-based filtering.
vector_search)
text_search)
rrf)
vector_search)Vector search retrieves records by semantic similarity using embeddings. It is ideal for finding related content even when exact keywords differ.
table: Dataset name (required)query: Search text (required)col: Column name (optional if only one embedding column)limit: Maximum results (optional)include_score: Include relevance scores (optional, default TRUE)See Vector-Based Search for configuration and advanced usage.
text_search)Full-text search uses BM25 scoring to retrieve records matching keywords in indexed columns.
table: Dataset name (required)query: Keyword or phrase (required)col: Column to search (required if multiple indexed columns)limit: Maximum results (optional)include_score: Include relevance scores (optional, default TRUE)See Full-Text Search for configuration and details.
rrf)Reciprocal Rank Fusion (RRF) combines results from multiple search queries to improve relevance by merging rankings from different search methods.
rrf is varadic and takes two or more search UDTF calls as arguments. An optional join key column and smoothing parameter can be provided. When no join key is specified, Spice will compute a JOIN key on-the-fly (by hashing rows) in order to fuse the results. Specifying an explicit JOIN key is recommended for optimal performance.
Arguments:
| Parameter | Type | Required | Description |
|---|---|---|---|
query_1 | Search UDTF call | Yes | First search query (e.g., vector_search, text_search) |
query_2 | Search UDTF call | Yes | Second search query |
... | Search UDTF call | No | Additional search queries (variadic) |
join_key | Column | No | Column name to use for joining results across queries |
k | Float | No | Smoothing parameter for RRF scoring (default: 60) |
How RRF works:
RRF Score = Σ(1 / (k + rank))k parameter controls ranking sensitivity (lower = more sensitive to rank position)Spice SQL supports traditional filtering for exact and pattern-based matches:
% matches any sequence of characters._ matches a single character.Returns rows where the column exactly matches the value.
Spice SQL does not support the ~ or !~ operators for regular expression matching. Instead, use scalar functions such as regexp_like, regexp_match, and regexp_replace for regex-based filtering. For details and examples, see the Scalar Functions documentation.
For more on hybrid and advanced search, see Search Functionality and Vector-Based Search.