Set up hybrid search in three steps
# spicepod.yamlembeddings: - from: openai name: openai_embeddings params: openai_api_key: ${secrets:OPENAI_API_KEY}datasets: - from: postgres:public.support_docs name: support_docs params: pg_host: ${secrets:PG_HOST} pg_db: support pg_user: ${secrets:PG_USER} pg_pass: ${secrets:PG_PASS} acceleration: enabled: true columns: - name: content embeddings: - from: openai_embeddings # Vector search row_id: - id full_text_search: enabled: true # Keyword search row_id: - idsql> SELECT id, title, _fused_score FROM rrf(vector_search(support_docs, 'how do I cancel my plan'), text_search(support_docs, 'cancel plan', content), join_key => 'id') ORDER BY _fused_score DESC LIMIT 3;# example output12 Cancel a subscription 0.032831 Pause your plan 0.031847 Plan cancellation fees 0.0161Connect your documents
In
spicepod.yaml, add a dataset for the table that holds your text. Setacceleration.enabled: trueto keep a local copy.Index a column for search
Add
embeddingsfor vector search andfull_text_searchfor keyword search on the same column.Fuse both searches in SQL
Start Spice with
spice run. Callvector_searchandtext_searchin one query, and merge the results withrrf().


