(
self,
search: &Search,
locale: Locale,
take: usize,
)
| 634 | |
| 635 | impl Objects { |
| 636 | pub fn into_matches( |
| 637 | self, |
| 638 | search: &Search, |
| 639 | locale: Locale, |
| 640 | take: usize, |
| 641 | ) -> Result<BTreeSet<SearchMatch>> { |
| 642 | let mut matches = BTreeSet::new(); |
| 643 | |
| 644 | for (_key, object) in self.0.into_iter() { |
| 645 | matches.insert(object.to_search_match(locale, search)?); |
| 646 | } |
| 647 | |
| 648 | // We won't know what is at the top of the results (e.g., a matching topic) until we've |
| 649 | // built the full btree set. So we wait to apply the limit until after this has been done. |
| 650 | Ok(matches.into_iter().take(take).collect()) |
| 651 | } |
| 652 | |
| 653 | pub fn into_hash(self) -> HashMap<Okey, Object> { |
| 654 | self.0 |
no test coverage detected