Hello, I´m trying to implement the search-ui with an elasticsearch API, based on the example provided in the library I have managed to make everything works except for the Autocomplete.
I´m seeing the autocomplete options, and I can select them, and I register the clicks on them, but I can´t find a way to show the selected autocomplete option, in the results component.
This is my configuration:
const config = {
debug: true,
hasA11yNotifications: true,
onResultClick: () => {
/* Not implemented */
},
onAutocompleteResultClick: async ({ documentId, query, ...args }) => {
/* Not implemented */
let requestBody = buildSearchByIDQuery(documentId);
const json = await runRequest(requestBody);
let state = buildState(json);
return state;
},
onAutocomplete: async ({ searchTerm }) => {
const requestBody = buildRequest({ searchTerm });
const json = await runRequest(requestBody);
const state = buildState(json);
return {
autocompletedResults: state.results
};
},
onSearch: async state => {
const { resultsPerPage } = state;
const requestBody = buildRequest(state);
// Note that this could be optimized by running all of these requests
// at the same time. Kept simple here for clarity.
const responseJson = await runRequest(requestBody);
// const responseJsonWithDisjunctiveFacetCounts = await applyDisjunctiveFaceting(responseJson, state, ['visitors', 'states']);
// return buildState(responseJsonWithDisjunctiveFacetCounts, resultsPerPage);
return buildState(responseJson, resultsPerPage);
}
};
I´m able to get the documentID and even make the query but I don´t know how to display the result.