feat(search): add Search Intelligence module
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user