Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Search Modes

Bobbin supports three search modes, selectable via the --mode flag (CLI) or mode parameter (MCP).

Hybrid (Default)

bobbin search "error handling"           # hybrid is the default
bobbin search "error handling" --mode hybrid

Hybrid search runs both semantic and keyword searches in parallel, then merges results using Reciprocal Rank Fusion (RRF).

How RRF Works

  1. Run semantic search → get ranked list A
  2. Run keyword search → get ranked list B
  3. For each result, compute: score = w / (k + rank_A) + (1 - w) / (k + rank_B)
    • w = semantic_weight (default: 0.7)
    • k = smoothing constant (60)
  4. Sort by combined score

Results that appear in both lists get boosted. Results unique to one list still appear but with lower scores.

When to Use

Hybrid is the best default for most queries. It handles both conceptual queries (“functions that validate user input”) and specific terms (“parseConfig”) well.

Semantic

bobbin search "authentication middleware" --mode semantic

Semantic search converts your query into a 384-dimensional vector using the same embedding model as the index, then finds the most similar code chunks via approximate nearest neighbor (ANN) search in LanceDB.

Strengths

  • Finds conceptually similar code even when wording differs
  • “error handling” matches catch, Result<T>, try/except
  • Good for exploratory queries when you don’t know exact names

Limitations

  • May miss exact identifier matches that keyword search would find
  • Requires the embedding model to be loaded (slight startup cost on first query)

Keyword

bobbin search "handleRequest" --mode keyword
bobbin grep "handleRequest"              # grep always uses keyword mode

Keyword search uses LanceDB’s full-text search (FTS) index. It matches tokens in chunk content and names.

Strengths

  • Fast, exact matching
  • Finds specific identifiers, variable names, and error messages
  • No embedding model needed

Limitations

  • No semantic understanding — “error handling” won’t match “catch”
  • Token-based, not substring-based (FTS tokenization rules apply)

Comparison

FeatureHybridSemanticKeyword
Conceptual matchingYesYesNo
Exact identifier matchingYesWeakYes
SpeedModerateModerateFast
Requires embeddingsYesYesNo
Default modeYesNoNo

Configuration

The hybrid search balance is controlled by semantic_weight in .bobbin/config.toml:

[search]
semantic_weight = 0.7  # 0.0 = keyword only, 1.0 = semantic only
default_limit = 10

Higher values favor semantic results; lower values favor keyword matches. The default (0.7) works well for most codebases.

grep vs search –mode keyword

Both use the same underlying FTS index. The differences:

Featurebobbin grepbobbin search --mode keyword
Regex supportYes (--regex)No
Case-insensitiveYes (-i)No
Matching lines shownYesNo
Output formatGrep-style with line highlightingSearch-style with scores