semanticRatio parameter: pure keyword search, pure semantic search, and hybrid search. Each mode has strengths and weaknesses depending on your data and how your users search.
This page helps you understand the tradeoffs and pick the right approach for your use case.
The three search modes
ThesemanticRatio parameter controls how Meilisearch blends keyword and semantic results:
| Mode | semanticRatio | How it works |
|---|---|---|
| Pure keyword | 0.0 | Meilisearch uses only full-text matching. Results must contain the query terms (or close variants). No embedder is queried. |
| Hybrid | 0.0 < ratio < 1.0 | Meilisearch runs both keyword and semantic search, then merges the results. Lower values favor keyword matches, higher values favor semantic matches. |
| Pure semantic | 1.0 | Meilisearch uses only vector similarity. Results are ranked by how close their embeddings are to the query embedding. |
When to use each mode
Pure keyword search (semanticRatio = 0)
Best when:- Users search for exact product names, SKUs, or identifiers
- Your dataset contains structured data with specific terminology (legal documents, medical records)
- You need deterministic, explainable results
- You want to avoid the latency cost of generating query embeddings
"iPhone 15 Pro Max 256GB""error code 0x80070005""Moby Dick Herman Melville"
Pure semantic search (semanticRatio = 1)
Best when:- Users describe what they need in natural language rather than using specific terms
- Your content is homogeneous (all product descriptions, all articles, all Q&A pairs)
- Vocabulary mismatch is common (users say “laptop” but documents say “notebook computer”)
- You are building conversational search or Q&A features
"something to keep my coffee warm at my desk""how do I fix a leaky kitchen faucet""comfortable shoes for standing all day"
Hybrid search (0 < semanticRatio < 1)
Best when:- Your users mix specific terms with natural language descriptions
- Your dataset contains diverse content types
- You want to catch both exact matches and conceptually relevant results
- You are building ecommerce search, documentation search, or knowledge bases
"wireless ergonomic keyboard"(keyword “wireless” + semantic “ergonomic”)"python async database connection"(technical terms + conceptual meaning)"red summer dress under $50"(product attributes + style description)
Tradeoffs
Relevancy
Hybrid search typically delivers the best overall relevancy for general-purpose applications. Pure keyword search excels for exact-match queries but misses conceptually similar results. Pure semantic search handles vocabulary mismatch well but may miss results that contain the exact query terms.Latency
| Mode | Relative latency | Notes |
|---|---|---|
| Pure keyword | Fastest | No embedding generation needed |
| Pure semantic | Moderate | Requires generating a query embedding |
| Hybrid | Slowest | Runs both keyword and semantic search, then merges results |
Vocabulary mismatch handling
This is where semantic search provides the most value. Consider a kitchenware dataset:| Query | Keyword results | Semantic results |
|---|---|---|
"spatula" | Documents containing “spatula” | Documents about spatulas, turners, flippers |
"something to flip pancakes" | Few or no results | Spatulas, turners, griddle tools |
"KitchenAid KFE5T" | Exact product match | May return similar products instead |
Decision guide
Use the following table to choose your startingsemanticRatio:
| Use case | Recommended ratio | Reasoning |
|---|---|---|
| Ecommerce product search | 0.5 to 0.7 | Users mix product names with descriptive queries |
| Documentation or knowledge base | 0.5 to 0.8 | Natural language questions benefit from semantic matching |
| Code search | 0.0 to 0.3 | Exact token matching is critical for code |
| Q&A or support tickets | 0.7 to 1.0 | Users describe problems in varied language |
| Catalog with SKUs and part numbers | 0.0 to 0.3 | Exact identifiers must match precisely |
| Blog or article search | 0.5 to 0.7 | Mix of topic searches and specific queries |
When NOT to use hybrid search
Hybrid search is not always the best choice. Consider pure semantic search (semanticRatio: 1.0) instead when:
- Image-only search: if your data is purely visual (image catalogs with no text metadata), keyword search has nothing to match against. Use pure semantic search with multimodal embeddings.
- Similarity-based use cases: if you are building a recommendation system using the
/similarendpoint, you are already using pure vector similarity. Hybrid search does not apply. - Pre-computed embeddings without text: if you provide your own embeddings for non-textual content (audio, sensor data), there are no keywords to match.
Next steps
Custom hybrid ranking
Fine-tune semanticRatio and test different configurations
Full-text search
Learn more about Meilisearch’s keyword search capabilities
Hybrid search overview
Overview of hybrid and semantic search in Meilisearch