MCPcopy Create free account
hub / github.com/Rustixir/darkbird / search

Method search

src/darkbird/storage.rs:323–335  ·  view source on GitHub ↗
(&self, text: String)

Source from the content-addressed store, hash-verified

321 /// search by text
322 #[inline]
323 pub fn search(&self, text: String) -> Vec<Ref<K, Doc>> {
324 let words: Vec<&str> = text.split_whitespace().collect();
325 let keys = self.inverted_index.search(words);
326 let mut result = Vec::with_capacity(keys.len());
327
328 for key in keys {
329 if let Some(rd) = self.collection.get(&key) {
330 result.push(rd);
331 }
332 }
333
334 result
335 }
336
337 /// return Iter (Safe for mutation)
338 #[inline]

Callers 1

mainFunction · 0.45

Calls 2

lenMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected