Skip to content

op search_multi

Mikhail Deynekin edited this page Nov 22, 2026 · 7 revisions

search_multi

Search "in one answer": several queries, copies, encodings (P1-1).

Group Navigation and reading
Edition community — works without a licence
Capability search — the feature that carries this operation; the licence matrix is on 15 · Editions and licensing
MCP tool ragraf_search_multi · read-only · idempotent · requires queries
CLI ragraf -p <config> query search_multi …

Why it exists

The same text lives in a project in ten places: Allowed formats is eight copies of php/Wizard/Files*.php, upload.php and templates/Files.html. An agent searched them one query at a time, two to four calls, and still did not know which file is LIVE and which is a copy — that took a separate reading of the JavaScript. This operation answers in one call.

What it solves

  • Run several queries at once, so a family of copies is found in one answer.
  • Find a literal string that tokenisation cannot match ('MCH', 'MOL'): search is literal over chunk text, with exact comparison after an FTS pre-selection.
  • Tell the live file from a copy: hits are grouped into file families, and each file is named as entry point, active (referenced from code or markup) or a copy nothing refers to, with a path:line for the claim.
  • See the file encoding of every hit, so a Russian string in a CP1251 file stops looking absent.

How to use it

The call that produced the answer below, as a command line:

$ ragraf -p demo-corpus.yaml query search_multi order|user

The same call through MCP: ragraf_search_multi(queries=…).

The answer below was captured on the demo corpus, not written for the page:

{
 "op": "search_multi",
 "index_rev": "rev-0002",
 "capability": "degraded",
 "provenance": "index",
 "found": true,
 "result": {
  "queries": [
   {
    "query": "order",
    "regex": false,
    "method": "fts",
    "hits": [
     "... 10 more"
    ],
    "hit_count": 12,
    "files": 8
   },
   {
    "query": "user",
    "regex": false,
    "method": "fts",
    "hits": [
     "... 13 more"
    ],
    "hit_count": 15,
    "files": 8
   }
  ],
  "families": [
   {
    "family": "src/app/repository.py",
    "members": [],
    "active": "src/app/repository.py",
    "copies": [
     "src/app/repository.py"
    ],
    "also_referenced": [],
    "referenced_outside_hits": []
   },
   {
    "family": "src/app/models.py",
    "members": [],
    "active": "src/app/models.py",
    "copies": [
     "src/app/models.py"
    ],
    "also_referenced": [],
    "referenced_outside_hits": []
   },
   "... 5 more"
  ],
  "summary": {
   "queries": 2,
   "hits": 27,
   "files": 8,
   "families": 7,
   "methods": {
    "fts": 2
   },
   "seconds": 0.002
  }
 },
 "limits_count": 2
}

The call succeeded. The answer is trimmed to two items per list and to the fields that carry no Russian prose: limits and the explanatory strings are counted in the footer below instead of being quoted.

Parameters

Name Type Default
queries list[str] required
limit int 20
scope str | None None
regex bool False
answer bool False

What it returns

Result keys visible in the code: families, queries, scope, summary.

The body also writes these fields into the answer envelope itself (extra): grouping, suggest.

The envelope around the result is the same for every operation; how to read it: 04 · Operations reference.

How it works

Step What happens
Reads none of the three stores directly — the answer comes through the engine the body calls, or from what the call is given
Calls no module function: the body computes the answer itself
Guarded by the index revision is read (current_rev), so every fact belongs to a named revision; a missing index is refused by name (_no_index) instead of raising
Writes grouping, suggest into the answer envelope
Empty answer yes, and names where to go instead: search, repo_map, symbol
flowchart TD
  Start[query search_multi]
  Rev{index revision}
  NoIndex[refused: no index]
  Body[operation body]
  Found{found}
  Empty[empty result + suggest: search repo_map symbol]
  Out[envelope with result]
  Start --> Rev
  Rev -- none --> NoIndex
  Rev -- rev-N --> Body
  Body --> Found
  Found -- no --> Empty
  Found -- yes --> Out
Loading

Where it stops

Every answer carries a limits field, and it is never empty when a boundary exists: that is where the limits of this particular call are named — which part of the corpus was not covered, which fact could not be confirmed, what the operation refused to guess.

The boundary of the whole Navigation and reading group is stated once, on the reference page. It is a sentence about the group, so it is not repeated here as if it were a sentence about search_multi.

Around this group

← previous in the group: search

→ next in the group: symbol

The full table with all 87 operations · A–Z index · Navigation and reading


Where these fields come from: the parameters, their types and defaults are read from the signature op_search_multi in src/ragraf/facade.py:5217 (line numbers as of 0.12.0); the MCP annotations from the tool registration; the edition from src/ragraf/edition_baseline.json; the guards, calls, stores, envelope fields and the diagram from the body of that same method. The example is a run of tools/build-op-examples.py on the demo corpus at revision rev-0002; fields whose value is Russian prose in this build (limits, explanatory strings) are counted, not quoted. Nothing else on this page is written by hand.

The reason and the tasks above are a translation of the docstring of op_search_multi, src/ragraf/facade.py:5217, kept in tools/op-text.json next to the line it came from. That file is the only hand-written text in the pipeline; the gate tools/check-op-text.py checks that the line exists and that its text is English.

Clone this wiki locally