| 412 | } |
| 413 | |
| 414 | fn topic_searches( |
| 415 | &self, |
| 416 | repo_id: RepoId, |
| 417 | topic: Option<RepoTopic>, |
| 418 | ) -> Result<BTreeSet<Search>> { |
| 419 | if !self.viewer.can_read(repo_id) { |
| 420 | return Err(Error::NotFound(format!("not found: {topic:?}"))); |
| 421 | } |
| 422 | |
| 423 | let searches = match topic { |
| 424 | Some(topic) => { |
| 425 | let mut searches = BTreeSet::new(); |
| 426 | |
| 427 | for synonym in topic.synonyms() { |
| 428 | let search = Search::parse(&synonym.name)?; |
| 429 | if search.is_empty() { |
| 430 | continue; |
| 431 | } |
| 432 | searches.insert(search); |
| 433 | } |
| 434 | |
| 435 | searches |
| 436 | } |
| 437 | None => BTreeSet::new(), |
| 438 | }; |
| 439 | |
| 440 | Ok(searches) |
| 441 | } |
| 442 | |
| 443 | pub fn mutation(&self, mode: IndexMode) -> Result<Mutation> { |
| 444 | Ok(Mutation { |