Hi, on a React Pages project I’m working on, on the locator page, I’ve added the search bar using the component
Is this the right component to use? It doesn’t seem to have the option to add a search button to it, so I decided to add a custom button next to it.
The button has a function assigned to the onclick event that sets a new query and executes a Vertical Query (using searchActions)
The results are correctly updated, but it doesn’t seem to integrate very well. I have a couple of questions:
- I can’t find a Matcher of type “similar/starts with”, is there anything I can use instead when setting a static filter?
- After running the query, the search field is emptied, is this to be expected (which means I should repopulate it with the user’s input after the query has been executed) or is my code not integrating how it should?
- Am I supposed to use a different component altogether, that already comes with the button instead (I couldn’t find it)?
For reference, this is the code run in the onclick function:
const locationFilter: SelectableStaticFilter = {
selected: true,
filter: {
kind: "fieldValue",
fieldId: "address.city", // should this be builtin.location?
value: query, // query is defined previously, and corresponds to the search field's value
matcher: Matcher.Equals,
},
};
searchActions.setQuery(query);
searchActions.setStaticFilters([locationFilter]);
searchActions.executeVerticalQuery();
Any help is greatly appreciated as usual!