PostgreSQL pgvector-backed vector store.
This is the default vector store backend, using the existing Arcana schema with pgvector extension for similarity search.
Breaking name change
In v1.7 the hybrid-search opts :semantic_weight and :fulltext_weight
were renamed to :vector_weight and :keyword_weight. The old names
are no longer accepted: callers passing them get a Logger.warning
and the default 0.5 weight.
Configuration
config :arcana, vector_store: :pgvector # defaultNotes
This backend works with the existing arcana_chunks and arcana_documents
tables. The collection parameter maps to the document's collection_id.
For simpler use cases without the full document schema, consider the
:memory backend.
Summary
Functions
Performs hybrid search combining semantic and fulltext search in a single query.
Functions
Performs hybrid search combining semantic and fulltext search in a single query.
This approach retrieves all results in one database query, avoiding the issue where items ranking moderately in both semantic and fulltext searches might be missed by separate queries.
Options
:repo- The Ecto repo to use (required):limit- Maximum number of results (default: 10):source_id- Filter results to a specific source:vector_weight- Weight for vector score (default: 0.5):keyword_weight- Weight for keyword score (default: 0.5):threshold- Minimum combined score threshold (default: 0.0)
Score Normalization
Vector scores (cosine similarity) naturally range from 0-1. Keyword scores (ts_rank) vary based on document content. This function normalizes keyword scores using min-max scaling within the result set to ensure fair combination.