Skip to content

BM25 search returns fewer results when multiple -c collection flags are used #181

@jennaWILDE

Description

@jennaWILDE

Bug Description

When using qmd search with multiple -c (collection) flags, significantly fewer results are returned compared to searching without any collection filter.

Steps to Reproduce

Given an index with multiple collections (e.g. notes, docs, sessions):

# Without collection filter — returns 5 results, scores 0.94-0.96
qmd search "Plugin Development Bootstrap" --json -n 8

# With all collections explicitly listed — returns only 1 result
qmd search "Plugin Development Bootstrap" --json -n 8 -c notes -c docs -c sessions

Expected Behavior

Specifying all collections via -c flags should return the same results as not specifying any collection filter (which implicitly searches all collections).

Actual Behavior

Multi-collection search returns significantly fewer results. In the example above:

  • No -c flags: 5 results (scores 0.94–0.96), including matches from notes and docs collections
  • All -c flags: Only 1 result (from sessions)

Results from notes and docs collections are lost when explicitly filtering.

Environment

  • qmd 1.0.0
  • Node.js v25.5.0
  • macOS (Apple Silicon)
  • Index: ~700 files across 4 collections, ~1300 embeddings

Workaround

Omitting the -c flags and searching across all collections works correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions