(&self, query: &str)
| 150 | } |
| 151 | |
| 152 | fn kg_fts_match_ids(&self, query: &str) -> PristineResult<Vec<(String, usize)>> { |
| 153 | let fts_table = match self.txn.open_multimap_table(KG_FTS) { |
| 154 | Ok(t) => t, |
| 155 | Err(redb::TableError::TableDoesNotExist(_)) => return Ok(Vec::new()), |
| 156 | Err(e) => return Err(PristineError::from(e)), |
| 157 | }; |
| 158 | |
| 159 | let tokens = tokenize_for_fts(query); |
| 160 | if tokens.is_empty() { |
| 161 | return Ok(Vec::new()); |
| 162 | } |
| 163 | |
| 164 | let mut hit_counts: std::collections::HashMap<String, usize> = |
| 165 | std::collections::HashMap::new(); |
| 166 | for token in &tokens { |
| 167 | let iter = match fts_table.get(token.as_str()) { |
| 168 | Ok(iter) => iter, |
| 169 | Err(_) => continue, |
| 170 | }; |
| 171 | for result in iter { |
| 172 | let node_id_guard = result?; |
| 173 | let node_id = node_id_guard.value().to_string(); |
| 174 | *hit_counts.entry(node_id).or_insert(0) += 1; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | Ok(hit_counts.into_iter().collect()) |
| 179 | } |
| 180 | |
| 181 | fn count_kg_nodes(&self) -> PristineResult<usize> { |
| 182 | let table = match self.txn.open_table(KG_NODES) { |
nothing calls this directly
no test coverage detected