Home > widget-integration > RecentSearchService > addRecentSearch
RecentSearchService.addRecentSearch() method
Add a search term to recent searches.
**Legacy**: setOnClickRecentSearches(item, extraParam, scope) **New**: addRecentSearch(query, extraParam, scope) with deduplication
Features: - Moves duplicate searches to the top (case-insensitive) - Trims whitespace from query - Limits storage to MAX_ITEMS
Signature:
addRecentSearch(query: string, extraParam?: string, scope?: string): void;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
query |
string |
Search term to add |
|
extraParam |
string |
(Optional) Optional extra URL parameters |
|
scope |
string |
(Optional) Optional search scope |
Returns:
void