Search Modes

Snipara offers three search modes for querying documentation. Choose the right mode based on your query type for optimal results.

Overview

ModeDescriptionPlanSpeedBest For
KeywordTraditional term matchingFREEFastExact terms, function names
SemanticEmbedding-based similarityPRO+MediumConcepts, natural language
HybridCombined approach (recommended)PRO+MediumGeneral queries, best overall

Keyword Search

Keyword search uses TF-IDF-like scoring optimized for documentation. Great for finding specific terms, function names, or error codes.

How It Works

score = (title_matches × 3) + (content_matches × 1) + (exact_phrase × 2)

Weights:
  • Title match:   3× (query terms in section title)
  • Content match: 1× (query terms in section content)
  • Exact phrase:  2× (exact query phrase found)
  • Section level: 1.2× per level (H1 > H2 > H3)

Configuration

rlm_context_query({
  query: "handleAuthError function",
  search_mode: "keyword",
  max_tokens: 8000
})

Best Use Cases

  • Exact term searches: Function names, error codes
  • Technical queries: API endpoints, configuration keys
  • Low latency needs: When speed is critical
  • FREE plan users: Only option available on free tier
Limitation: Does not understand synonyms (auth ≠ authentication). Use hybrid mode for better concept matching.

Semantic Search

Semantic search uses embedding vectors to find conceptually similar content. Understands meaning, not just keywords.

How It Works

1. Generate embedding for query using BAAI/bge-large-en-v1.5
2. Compare against pre-computed document chunk embeddings
3. Rank by cosine similarity
4. Return top N results with similarity > 0.3

Model: BAAI/bge-large-en-v1.5
Dimensions: 1024
Max tokens per chunk: 512

Configuration

rlm_context_query({
  query: "How does the system handle authentication errors?",
  search_mode: "semantic",
  max_tokens: 8000
})

Best Use Cases

  • Conceptual queries:"How does the system handle errors?"
  • Natural language: Questions phrased conversationally
  • Synonym handling:Finds "auth" when searching "login"
  • Cross-reference: Finds related concepts across docs

Hybrid Search (Recommended)

Hybrid search combines keyword and semantic using Adaptive Reciprocal Rank Fusion. Automatically adjusts weights based on query type.

Recommended Default

Hybrid mode is the best choice for most queries. It combines the strengths of both keyword and semantic search while mitigating their weaknesses.

Adaptive Weight Profiles

ProfileKeywordSemanticTriggered When
Keyword-Heavy70%30%Exact terms, specific lookups (pricing, schema, endpoint)
Balanced50%50%Default for most queries
Semantic-Heavy30%70%Conceptual queries (how/why/explain)

Query Classification (Auto)

The system automatically classifies your query in ~0ms (no LLM call) to choose the optimal weights:

  • Keyword-heavy: Query contains specific terms like pricing, schema, endpoint, api
  • Semantic-heavy:Query starts with "how does", "why", "explain", "compare"
  • Balanced: Everything else

Configuration

rlm_context_query({
  query: "How does the system handle authentication errors?",
  search_mode: "hybrid",  // default
  max_tokens: 8000
})

Performance Comparison

Latency (P50)

ModeCold StartWarm
Keyword50ms15ms
Semantic200ms80ms
Hybrid250ms100ms

Accuracy (F1 Score)

Query TypeKeywordSemanticHybrid
Exact term0.920.750.93
Conceptual0.550.880.92
Natural language0.450.850.88
Mixed0.680.820.94

When to Use Each Mode

Keyword

  • Looking for specific function
  • Error code lookup
  • API endpoint discovery
  • Configuration key search
  • Need maximum speed

Semantic

  • "How does X work?"
  • Architecture understanding
  • Conceptual explanations
  • Finding related content
  • Natural language questions

Hybrid (Default)

  • General documentation search
  • Complex questions
  • Best practices search
  • When unsure which to use
  • Production recommended

Plan Gating

Search ModeFREEPROTEAMENTERPRISE
KeywordYesYesYesYes
SemanticNoYesYesYes
HybridNoYesYesYes

Downgrade behavior: If a FREE plan user requests semantic or hybrid, the request is automatically downgraded to keyword search with a warning in the response.

Next Steps