SearchBox (Insight Engine)
SearchBox (Insight Engine)
|
|
Note
This component was introduced in version |
Methods
clear
Clears the search box text and the suggestions.
selectSuggestion
Selects a suggestion and calls submit.
Parameters
-
value:
stringThe string value of the suggestion to select
showSuggestions
Shows the suggestions for the current search box value.
submit
Deselects all facets and triggers a search query.
updateText
Updates the search box text value and shows the suggestions for that value.
Parameters
-
value:
stringThe string value to update the search box with.
subscribe
Adds a callback that’s invoked on state change.
Parameters
-
listener:
() => voidA callback that’s invoked on state change.
Returns Unsubscribe: A function to remove the listener.
Attributes
state
The state of the SearchBox controller.
Properties
-
isLoading:
booleanDetermines if a search is in progress.
-
isLoadingSuggestions:
booleanDetermines if a query suggest request is in progress.
-
suggestions:
Suggestion[]The query suggestions for the search box query.
-
value:
stringThe current query in the search box.
Initialize
buildSearchBox
Creates an insight SearchBox controller instance.
Parameters
-
engine:
InsightEngineThe insight engine.
-
props:
SearchBoxPropsThe configurable
SearchBoxproperties.
Returns SearchBox
SearchBoxProps
The configurable SearchBox properties.
Properties
-
options?:
SearchBoxOptionsThe
SearchBoxcontroller options.
SearchBoxOptions
The SearchBox controller options.
Properties
-
clearFilters?:
booleanWhether to clear all active query filters when the end user submits a new query from the search box. Setting this option to "false" is not recommended and can lead to an increasing number of queries returning no results.
-
enableQuerySyntax?:
booleanWhether to interpret advanced Coveo query syntax in the query.
Default:
false -
highlightOptions?:
SuggestionHighlightingOptionsSpecifies delimiters to highlight parts of a query suggestion that e.g match, do not match the query.
-
id?:
stringA unique identifier for the controller. By default, a unique random identifier is generated.
-
numberOfSuggestions?:
numberThe number of query suggestions to request from Coveo ML (for example,
3).Using the value
0disables the query suggest feature.Default:
5
Related types
Delimiters
Properties
-
close:
stringClosing delimiter
-
open:
stringOpening delimiter
Suggestion
Properties
-
highlightedValue:
stringThe suggestion after applying any
highlightOptions. -
rawValue:
stringThe suggestion text.
SuggestionHighlightingOptions
Properties
-
correctionDelimiters?:
DelimitersDelimiters for substrings that are correction of the input
-
exactMatchDelimiters?:
DelimitersDelimiters for substrings that are exact match of the input
-
notMatchDelimiters?:
DelimitersDelimiters for substrings that do not match the input
Unsubscribe
Call signatures
-
(): void;