(&self, text: String)
| 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] |