Expand description
§mant-query
Bounded semantic queries over existing ManT document snapshots. This crate
selects content, projects outlines and references, searches canonical content,
and collects independent explanation evidence. It does not discover sources,
load files, resolve remote documents, render reports, or modify input IR.
§Existing content in, query results out
Single-document operations borrow mant_ir::ResolvedContent. Requests and
versioned response DTOs belong to mant-protocol; original document nodes,
typed locations, identities and reference scanning belong to mant-ir.
use mant_ir::{Document, ResolvedContent};
use mant_protocol::OutlineNode;
use mant_query::build_outline;
// The caller already has IR: no source parser or loader is needed here.
let document: Document = serde_json::from_value(serde_json::json!({
"source": { "format": "markdown" },
"meta": {},
"sections": [{
"id": "usage",
"heading": { "content": [{ "type": "text", "value": "Usage" }] },
"blocks": [],
"children": []
}]
}))?;
let content = ResolvedContent {
label: "demo".to_owned(),
address: None,
document: Some(document),
tldr: None,
};
let outline = build_outline(&content)?;
assert!(matches!(
outline.nodes.as_slice(),
[OutlineNode::DocumentSection { title, .. }] if title == "Usage"
));Content selection uses explicit paths or IDs, never name guessing. Explain is a separate evidence query: repeated names produce independent evidence, not a first-match selection. Classification, global order, paging and content-copy budgets remain explicit in the result, including partial coverage.
§Collections without a loader dependency
QueryScopeView::new validates a borrowed logical graph against its ordered
content slice. It checks address and traversal consistency without cloning,
loading or serializing the documents. Callers retain ownership and must supply
one coherent snapshot; this validation does not prove remote freshness.
search_scope and explain_scope share global query budgets and pagination.
Use mant-loader to acquire content when needed, or compose an application’s
complete request with mant-engine. Neither is a dependency of this package.
Query errors stay separate from source acquisition and host delivery errors.
§Format boundary
Markdown-scope search uses the canonical Markdown artifact and source mapping
from mant-codec, with native features disabled. Its text and ranges refer to
the same borrowed source snapshot. This format dependency does not enable
native parsing or report rendering. Reference destination checks inspect
typed logical addresses and already supplied content only; they perform no IO.
See the protocol manual for process contracts and the IR manual for authoritative content ownership. The crate is Apache-2.0 licensed.
Structs§
- Query
Scope View - An immutable graph and its exact, ordered content snapshots.
- Reference
Projection Limits - Independent reference operation budgets; input-file size is not a substitute.
- Resolved
Content - One materialized document query before any versioned process projection.
- Selector
Candidate - One exact path offered when a content ID has multiple owners.
Enums§
- Explanation
Error - Invalid explanation request or missing readable source.
- Projection
Error - Failure to derive an addressable view from a complete query.
- Scope
Execution Error - Query failures independent of catalog resolution and source I/O.
- Scope
Input Error - Invalid association between a logical loading report and supplied content.
- Search
Error - Invalid search input or matcher construction.
Functions§
- build_
outline - Build a block-free, addressable outline for one complete query.
- build_
outline_ projection - Build a structural outline with an explicit semantic-entry projection.
- build_
outline_ with_ detail - Build an outline with optional semantic definition entries.
- build_
outline_ with_ references - Project exact local content and independently scan its real references.
- explain_
query - Collect independent semantic and literal evidence without unique selection.
- explain_
scope - Explain across existing snapshots with global classification and paging. No catalog lookup, parsing or source acquisition is performed.
- project_
references - Project selected original links without catalog I/O or implicit document loading. Invalid policies return an unscanned inventory; process boundaries validate first.
- project_
references_ with_ limits - Project under explicit hard-clamped budgets, including all skipped offset work.
- resolve_
explanation_ block - Resolve an explanation block/preview coordinate in the exact queried IR.
- search_
query - Search one complete query and report coordinates in its canonical Markdown.
- search_
scope - Search existing snapshots with one global result cursor. No loading or parsing occurs; coverage remains in the supplied graph.
- select_
excerpt - Select tldr, document-root content, or complete section subtrees by path or ID.
- select_
explanation - Collect semantic evidence with the documented default page/copy budgets.
Use
explain_queryfor explicit pagination; usecrate::select_excerptfor strict node navigation. No-evidence is a normal response. - semantics_
complete - Whether all producers and shared validators permit a complete projection. Consumers must not infer this effect from diagnostic severity, text or codes.
- validate_
explanation_ query - Validate literal and copy bounds before loading any source.
- validate_
search_ query - Validate search limits and compile its matcher without loading a manual.