1. search

@sitecore-cloudsdk/search/browser

Version:
Import path@sitecore-cloudsdk/search/browser

The browser module of the Cloud SDK search package provides the following functions, classes, interfaces, types, and variables to create search experiences and capture search events from the browser side.

Functions

Work with widgets and events using the following functions:

NameDescription
addSearchUsed as a method by the CloudSDK function to initialize the search package.
Widgets
getWidgetDataRetrieves data for one or more widgets.
Events
widgetViewSends a widget view event.
widgetItemClickSends a widget item click event.
widgetFacetClickSends a facet click event.
widgetNavigationClickSends a navigation click event.
widgetSuggestionClickSends a suggestion click event.
entityViewSends an entity view event.

Classes

NameDescription
Widgets
WidgetRequestDataData about the widget or widgets to retrieve.
SearchWidgetItemA widget item for a search widget.
RecommendationWidgetItemA widget item for a recommendation widget.
QuestionsAnswersWidgetItemA widget item for a questions-answers widget.
Context
ContextDetails about the site visitor's search request, such as locale, location, device, and web browser information. Sitecore Search uses this data for personalizing search results.
Filters
ComparisonFilterA filter with relation conditions. Used for filtering search results by comparing the entity's attribute to a certain value.
ListFilterA filter that returns search results if all or any of a set of values are included in a certain attribute.
LogicalFilterA filter with logical conditions. Used for returning search results that match a set of filters or that do not match a certain filter.
GeoFilterA filter that returns search results depending on geographical data, such as the radius of a circular geographical area.
GeoWithinFilterA filter that returns search results depending on geographical data, such as an area defined by polygon area coordinates.
Filters for facets
ComparisonFacetFilterA filter with relation conditions. Used for filtering facet values by comparing the facet value to a certain value you provide.
ListFacetFilterA filter that returns facet values if all or any of a set of values are included in a certain facet value.
LogicalFacetFilterA filter with logical conditions. Used for returning search results that match a set of filter values or that do not match a certain filter value.
NotFacetFilterA filter that returns search results that do not match a certain filter value.

Interfaces

Structure objects using the following interfaces:

NameDescription
Events
SearchEventEntityData about the index documents the site visitor interacts with in the search results.
SearchEventRequestData common to search events.
EntityViewEventParamsData for entity page view events.
WidgetViewEventParamsData for widget view events.
WidgetItemClickEventParamsData for widget item click events.
WidgetFacetClickEventParamsData for facet click events.
WidgetNavigationClickEventParamsData for navigation click events.
WidgetSuggestionClickEventParamsData for suggestion click events.
Widgets
SearchOptionsOptions for the search widget item object.
QueryOptionsThe query object of the search widget item. Settings related to the site visitor's search query.
SearchSortOptionsSorting configuration for search results.
SortValueThe sort parameter options of the search widget item. Used to configure the sorting of search results.
SearchRuleOptionsOptions for rules. Rules are modifications to widget behavior that can be used to overwrite the natural set of search results, for example, to boost, bury, pin, and blacklist items.
BoostBoost rules for a search request. Used to improve the visibility of certain content by making an item or group of items appear higher in the search results.
IncludeInclude rules for a search request. Used to force a list of items or categories to appear in specific slots, even if they are not in the natural results set for a request.
PinItemPin rules for a search request. Used to force a single item or category to appear in a specific slot even if it is not in the natural results set for a request.
SearchSuggestionOptionsThe suggestion parameter of the search widget item. Used to configure search suggestions.
SearchRankingOptionsThe ranking parameter of the search widget item. Used to configure search result ranking.
ResultsOptionsThe results object of a widget item.
RecommendationThe recommendation object of a widget item.
Filters
LogicalFilterValuesLogical conditions for filtering search results.
GeoFilterDataGeographical data used for filtering search results.
SuggestionFilterEventParamsData common to search suggestions and facets. Part of the WidgetSuggestionClickEventParams data used when capturing suggestion click events.
Filters for facets
FacetFilterEventParamsData for facets. Part of the WidgetFacetClickEventParams data used when capturing facet click events.
RangeFacetFilterEventParamsData for range facets. Part of the WidgetFacetClickEventParams data used when capturing facet click events.
Facets
FacetOptionsThe facet object of the search widget item. Contains facet settings for the search request. For example, how many individual facets to retrieve and in what order.
FacetSortSorting configuration for the facet values in the individual facets. For example, the ability to sort in descending alphabetical order.
FacetTypeOptionsThe type object of a facet object. Settings for an individual facet.
Context
ContextDataDetails about the site visitor's search request, such as locale, location, device, and web browser information. Sitecore Search uses this data for personalizing search results.
LocaleDataThe country and language the webpage is being viewed in.
PageDataThe URI the site visitor came to the current webpage from.
UserDataData about the site visitor.
StoreDataData about the online store where the site visitor made the search request. Typically used in Buy Online Pickup In Store retail strategies.
CampaignDataThe UTM parameters in the URL of the webpage.
GeoDataGeographical data about the search request.
LocationDataIn context: the geographical coordinates of the location where the site visitor made the search request. In filters: the location that the site visitor wants to see search results for.
BrowserDataData about the site visitor's web browser.
QuestionsAnswersOptionsOptions for retrieving AI-powered questions and answers.
ExactAnswerOptionsOptions to retrieve a single answer to the site visitor's query. Used in the questions-answers object of a widget item.
RelatedQuestionsOptionsOptions to retrieve AI-generated question-and-answer pairs relevant to the site visitor's query. Used in the questions-answers object of a widget item.

Types

Populate data requests with objects implementing the following types:

NameDescription
Widgets
SearchPersonalizationOptionsOptions for personalizing search results.
RecommendationOptionsOptions to determine which recommendations are given by a recommendation widget.
QueryTypeThe type of site visitor query to retrieve an exact answer for.
PathnameThe relative path of the webpage to retrieve widget data for.
ContentOptionsThe content options property of the results widget item. Used to select the attributes to request for each item. For example, to request only the title and description attributes.
RecipeA recipe for recommendations. A recipe is used to determine which recommendations are given by a recommendation widget.
Filters
FilterVarious filter criteria that can be used to filter search results or recommendations.
OperatorsOne of the available operators. Operators are used for filtering search results.
ComparisonOperatorsComparison operators, such as greater than and less than or equal to. Used for filtering search results and facet values.
ListOperatorsOperators that check if all or any of a set of values are included in a certain attribute. Used for filtering search results.
LogicalOperatorsThe logical operators AND, OR, and NOT. Used for filtering search results.
GeoOperatorAn operator for using distance from a specific location to filter search results.
GeoWithinOperatorAn operator for using a polygonal area to filter search results.
GeoWithinFilterDataAn array of geographical coordinates. Used for filtering search results.
DistanceStringThe radius of the circular geographical area where you want Sitecore Search to find suitable search results.
DistanceUnitsThe accepted units of distance. Used in DistanceString.
Filters for facets
FacetFilterOne of the available facet filters. Facet filters are the filter settings to apply to a facet type.
FacetTypeFilterFilter for facet values.
FilteringOptionsOptions for filtering. Used for managing how other filtering affects this facet, and how filtering in this facet affects other facets.
Facets
FacetSortNameWhether to sort facet values alphabetically ("text"), or by the number of index items that have this value ("count").
SortingOptionsWhether to sort values in an ascending ("asc") or descending ("desc") order.

Variables

NameDescription
SEARCH_NAMESPACEThe Cloud SDK and package name.
If you have suggestions for improving this article, let us know!