Semantic search enables you to search documents using natural language queries instead of exact keyword matches. TopK automatically generates embeddings for your text fields and handles the similarity computation.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/topk-io/topk/llms.txt
Use this file to discover all available pages before exploring further.
Overview
With semantic search, you can:- Search using natural language queries without providing embeddings
- Automatically generate embeddings using built-in models
- Find semantically similar content even when exact words don’t match
- Combine semantic search with filters and other search types
Schema Setup
To enable semantic search on a field, add asemanticIndex() to a text field:
Supported Models
TopK supports the following embedding models:cohere/embed-v4(default)cohere/embed-english-v3cohere/embed-multilingual-v3
Embedding Types
You can specify the embedding data type for optimized storage:float32- Full precision (default)uint8- Quantized to 8-bit unsigned integersbinary- Binary embeddings for maximum compression
Inserting Documents
When you insert documents, TopK automatically generates embeddings for fields with semantic indexes:Querying with Semantic Search
Usefn.semanticSimilarity() to compute semantic similarity between your query and indexed fields:
Multiple Field Search
Combine semantic similarity scores from multiple fields:Combining with Filters
You can filter results before applying semantic search:Semantic indexes automatically handle embedding generation during document insertion. You don’t need to provide or manage embeddings yourself.
Related Concepts
- Reranking - Improve semantic search results with reranking
- True Hybrid Search - Combine semantic and keyword search
- Vector Search - Bring your own embeddings