search asks a mount’s own search to rank its records for a query: Dify’s
retrieval API, Chroma’s and Qdrant’s vector queries, mem0’s memory search and
LanceDB’s vector search. Use it when meaning matters; grep and rg still
match exact text.
Setup
search has no account config. It searches the mounts it is pointed at, so
register it on a workspace that mounts a store:
search. For YAML registration, see the
CLI overview:
Supported commands
Runsearch --help for the supported flags and operands.
This list is generated from Mirage’s registered command tree.
Usage
Each hit prints its path, then its score where the store ranks, then the
record’s text:
Mounts
Answer from a custom VFS
A custom VFS joins the list by definingsearch. It gets
the path the line names and a SearchQuery: the text in query, and in
options the top_k, threshold and method the line gives. It returns
one (path, record) pair per hit, the hit’s workspace path and the text
search prints; [] means no match and None declines. A VFS that ranks
several paths together defines search_many(paths, query) as well.
Pass the path on to the service, so a search under one folder ranks only
that folder’s notes and no other folder’s hits use up top_k.
ResponseCache and returns it from caches(); the mount then expires it
with its read policy and drops it after a write from outside Mirage.
await self.searches.get(key, fetch) answers from the cache or calls fetch.