MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / query_search

Function query_search

atomic-cli/src/commands/rpc.rs:1695–1741  ·  view source on GitHub ↗

`atomic memory show` over GetVaultEntry — every form. The wire carries the lift inputs (the stored entry) plus the RAW attestation sources, so the CLI runs its EXISTING bridge code unchanged over wire-carried inputs and projects with the same render the local body uses — byte-parity for the canonical JSON-LD projection and the `atomic vault query search` over QueryGraph (KgSearch) — every form: th

(args: &super::query::QueryNodes)

Source from the content-addressed store, hash-verified

1693/// before ranking/pool limits) and `--pool` names the retention budget. The plain
1694/// render reads the same kind/id/summary columns.
1695pub fn query_search(args: &super::query::QueryNodes) -> CliResult<bool> {
1696 let Some(session) = Service::open()? else {
1697 return Ok(false);
1698 };
1699 let request = pb::QueryGraphRequest {
1700 repository: Some(session.reference.clone()),
1701 limit: args.limit as u32,
1702 query: Some(pb::query_graph_request::Query::KgSearch(
1703 pb::KgSearchQuery {
1704 query: args.query.clone(),
1705 kind: args.kind.clone(),
1706 pool: args.pool.map(|pool| pool as u32),
1707 },
1708 )),
1709 view: None,
1710 };
1711 let response = session.query_graph(request)?;
1712 let nodes = response
1713 .nodes
1714 .iter()
1715 .map(kg_node_domain)
1716 .collect::<Vec<_>>();
1717 if args.json {
1718 println!("{}", serde_json::to_string_pretty(&nodes).unwrap());
1719 return Ok(true);
1720 }
1721 if nodes.is_empty() {
1722 println!("No results.");
1723 return Ok(true);
1724 }
1725 for node in &nodes {
1726 let summary = node.summary.as_deref().unwrap_or("");
1727 let summary_display = if summary.is_empty() {
1728 String::new()
1729 } else {
1730 format!(" {}", super::query::truncate_display(summary, 60))
1731 };
1732 println!(
1733 " [{}] {}{}",
1734 atomic_core::kg::ontology::compact(node.primary_type()),
1735 node.id,
1736 summary_display
1737 );
1738 }
1739 println!("\n{} result(s).", nodes.len());
1740 Ok(true)
1741}
1742
1743/// freeform body.
1744pub fn memory_show(args: &super::memory::show::MemoryShow) -> CliResult<bool> {

Callers 1

runMethod · 0.85

Calls 5

openFunction · 0.50
cloneMethod · 0.45
query_graphMethod · 0.45
iterMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected