If I understand correctly, you want that when user clicks on a query suggestions, he gets redirected to the search page using a field query instead of a free-text search query.
You could try to add the OmniboxResultList component and use the onSelect event property. It defines a callback that is executed when you select an option. This would allow very powerful customization as you can also define your own result template with it.
However, if you want this behavior to also happen in the searchbox without clicking on a result, for example, when pressing Enter to execute the query, you should use the beforeRedirect
event from the Omnibox
component instead. Here is an example usage of this event:
var searchBoxElement = Coveo.$('#@Model.SearchboxId');
searchBoxElement.on(Coveo.StandaloneSearchInterfaceEvents.beforeRedirect, function(e, data) {
// Get the current query and change it to a field query.
var currentQuery = Coveo.state(searchBoxElement[0], "q");
Coveo.state(searchBoxElement[0], "q", "@@YOUR_FIELD==\"" + currentQuery + "\"");
// Execute the redirection as usual with the new state.
var standaloneSearchInterface = Coveo.get(searchBoxElement[0], Coveo.SearchInterface);
standaloneSearchInterface.redirectToSearchPage(data.searchPageUri);
});
(Inspired from here: https://answers.coveo.com/questions/8192/redirect-to-detail-page-rather-search-result-page)