Autocomplete for siteSearch in SearchUI

I am trying to fix autocomplete for the SiteSearch Engine with SearchUI. I am unable to fix autocomplete with headless core components(my own build component) whereas it works for "SearchBox" SearchUI built-in component.
I tried to add "beforeAutocompleteResultsCall" but not working.
beforeAutocompleteResultsCall: (options, next) =>
next({
...options,
group: {
field: 'title'
}
})

Please provide help !

Hi @sarrame,

Call this action from your custom component:

setSearchTerm('river', {
  autocompleteResults: true,
  refresh: false
})

The details are listed here: https://github.com/elastic/search-ui/blob/master/ADVANCED.md#actions

After you call that, the results will be populated in the autocompletedResults field in state.

Documented here: https://github.com/elastic/search-ui/blob/master/ADVANCED.md#response-state

Hope that helps,

Jason

Thanks @JasonStoltz for quick response, will try it out !

Hi Jason @JasonStoltz , Do we have any example/ demo for Site search with SearchUI ? As I started newly on this I looking out for more options kindly let me know.

@sarrame

There are demos of Search UI running with App Search, Site Search, and Elasticsearch here: https://github.com/elastic/search-ui/blob/master/CONTRIBUTING.md#stable-demos.

https://search-ui-stable-site-search.netlify.com/

The code for that is in our Sandbox example: https://github.com/elastic/search-ui/blob/master/examples/sandbox/src/App.js.

Hope that helps.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.