feat(search): add Search Intelligence module

This commit is contained in:
sdarbinyan
2026-07-10 13:25:31 +04:00
parent 494451bb96
commit 7ecb19cb1a
29 changed files with 1030 additions and 251 deletions

View File

@@ -89,6 +89,7 @@ export class SearchFacade {
constructor() {
const history = this.historyService.getSnapshot();
this.store.setRecentSearches(history.recent);
this.store.setPopularSearches(this.popularSearches.map(item => item.title));
this.autocompleteInput$
.pipe(
@@ -128,19 +129,26 @@ export class SearchFacade {
return {
items: snapshot.items,
recent: snapshot.recent,
popular: this.popularSearches.map(item => item.title),
};
}
pushSearchHistory(term: string, maxHistory = 12): SearchHistory {
const snapshot = this.historyService.push(term, maxHistory);
this.store.setRecentSearches(snapshot.recent);
return snapshot;
return {
...snapshot,
popular: this.popularSearches.map(item => item.title),
};
}
clearSearchHistory(): SearchHistory {
const snapshot = this.historyService.clear();
this.store.setRecentSearches([]);
return snapshot;
return {
...snapshot,
popular: this.popularSearches.map(item => item.title),
};
}
trending(): Observable<SearchSuggestion[] | null> {