Skip to main content
Meilisearch supports three search modes controlled by the 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

The semanticRatio parameter controls how Meilisearch blends keyword and semantic results:
ModesemanticRatioHow it works
Pure keyword0.0Meilisearch uses only full-text matching. Results must contain the query terms (or close variants). No embedder is queried.
Hybrid0.0 < ratio < 1.0Meilisearch runs both keyword and semantic search, then merges the results. Lower values favor keyword matches, higher values favor semantic matches.
Pure semantic1.0Meilisearch 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
Example queries that work well with keyword search:
  • "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
Example queries that work well with semantic search:
  • "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
Example queries that benefit from hybrid search:
  • "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

ModeRelative latencyNotes
Pure keywordFastestNo embedding generation needed
Pure semanticModerateRequires generating a query embedding
HybridSlowestRuns both keyword and semantic search, then merges results
The latency difference depends on your embedder. Cloud-based embedders (OpenAI, Cohere) add network overhead for query embedding generation. Local embedders (HuggingFace) avoid network calls but use server CPU.

Vocabulary mismatch handling

This is where semantic search provides the most value. Consider a kitchenware dataset:
QueryKeyword resultsSemantic results
"spatula"Documents containing “spatula”Documents about spatulas, turners, flippers
"something to flip pancakes"Few or no resultsSpatulas, turners, griddle tools
"KitchenAid KFE5T"Exact product matchMay return similar products instead
Hybrid search balances these scenarios. It returns the exact “KitchenAid KFE5T” match from keyword search while also surfacing conceptually relevant “pancake flipper” results from semantic search.

Decision guide

Use the following table to choose your starting semanticRatio:
Use caseRecommended ratioReasoning
Ecommerce product search0.5 to 0.7Users mix product names with descriptive queries
Documentation or knowledge base0.5 to 0.8Natural language questions benefit from semantic matching
Code search0.0 to 0.3Exact token matching is critical for code
Q&A or support tickets0.7 to 1.0Users describe problems in varied language
Catalog with SKUs and part numbers0.0 to 0.3Exact identifiers must match precisely
Blog or article search0.5 to 0.7Mix of topic searches and specific queries
These are starting points. Test with real queries from your users and adjust based on the results you observe. 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 /similar endpoint, 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