| 91 | } |
| 92 | |
| 93 | async fn query_with_limit( |
| 94 | service: &LocalService, |
| 95 | repository: &pb::RepositoryRef, |
| 96 | view: Option<pb::ViewRef>, |
| 97 | query: pb::query_graph_request::Query, |
| 98 | limit: u32, |
| 99 | ) -> Result<pb::QueryGraphResponse, Box<tonic::Status>> { |
| 100 | let bytes = service |
| 101 | .call( |
| 102 | "/atomic.KnowledgeService/QueryGraph", |
| 103 | &pb::QueryGraphRequest { |
| 104 | repository: Some(repository.clone()), |
| 105 | view, |
| 106 | query: Some(query), |
| 107 | limit, |
| 108 | } |
| 109 | .encode_to_vec(), |
| 110 | ) |
| 111 | .await?; |
| 112 | Ok(pb::QueryGraphResponse::decode(bytes.as_slice()).unwrap()) |
| 113 | } |
| 114 | |
| 115 | fn search(term: &str) -> pb::query_graph_request::Query { |
| 116 | pb::query_graph_request::Query::KgSearch(pb::KgSearchQuery { |