Skip to content

search: multi-collection -c filtering returns empty when any collection has no matches #233

@bradleg1

Description

@bradleg1

Summary

When using qmd search with multiple -c (collection) flags, if any specified collection has zero matching results for the query, the entire search returns "No results found" — even if other collections have matches.

Reproduction

# Setup: 4 collections, all populated with indexed files
# Collection A has docs matching "Moo Moo", Collection B does not

# Single collection — works ✅
qmd search "Moo Moo" --json -n 4 -c collectionA
# Returns results

# Two collections where one has no match — fails ❌
qmd search "Moo Moo" --json -n 4 -c collectionA -c collectionB
# Returns: No results found.

# Without -c filters — works ✅
qmd search "Moo Moo" --json -n 4
# Returns results from all collections

Additional trigger: empty collections

Including a -c flag for a collection with 0 indexed files (e.g. a sessions collection with no exported transcripts yet) also causes the entire search to return empty, regardless of what other populated collections are specified.

# sessions-main has 0 files, memory-dir-main has 37 files

# Works ✅
qmd search "test" --json -n 4 -c memory-dir-main

# Fails ❌  
qmd search "test" --json -n 4 -c memory-dir-main -c sessions-main
# Returns: No results found.

Expected Behaviour

Results from collections that DO have matches should be returned, even if other specified collections have zero matches or zero indexed files.

Impact

OpenClaw passes all managed collection names via -c flags when searching. If any collection has no match for the query (common — e.g. searching for a venue name won't match in a CSS template collection), the entire search fails silently and returns empty.

This forces OpenClaw to fall back to its builtin embedding search, effectively making qmd search mode unusable as a multi-collection backend.

qmd query mode works around this by running separate per-collection queries, but requires LLM model loading (~35s cold start on CPU) which causes timeouts.

Environment

  • QMD v1.0.6
  • Bun 1.3.9
  • Linux x64, Ubuntu 24.04.3 LTS
  • 4 vCPUs, no GPU
  • OpenClaw v2026.2.19-2 (consumer)

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