algolia / algolia/autocomplete

Plugins createAutocomplete

Open
#1,169 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.3k
Forks
341
Avg merge
3d 1h
Merged PRs (30d)
5

Description

Hi Algolia,

I'm not sure how to implement plugins into my new custom Autocomplete I've create with createAutocomplete.

Like if I want to use these two plugins:

const plugins = useMemo(() => {
const recentSearchesPlugin = createLocalStorageRecentSearchesPlugin({
key: "instantsearch",
limit: 3,
});

const querySuggestionsPlugin = createQuerySuggestionsPlugin({
indexName: process.env.NEXT_PUBLIC_ALGOLIA_INSTANTSEARCH_QUERY_SUGGESTIONS_INDEX_NAME,
searchClient,
categoryAttribute: [
'instant_search',
'facets',
'exact_matches',
'categories',
],
transformSource({ source }) {
console.log("source", source)
return {
...source,
onSelect({ item }) {
setIndexUiState((indexUiState) => ({
...indexUiState,
query: item.query,
menu: {
categories: item.__autocomplete_qsCategory || '',
},
}));
},
};
},
});

return [recentSearchesPlugin ,querySuggestionsPlugin];
}, []);

And call my componet like this:

``

How should I go about it with the plugins?

Best Regards Freddy

Contributor guide

Open the contributing guide

Research direction

The issue names createAutocomplete, CustomAutocomplete, and the plugins prop, but no repository file or test. Start by locating the createAutocomplete plugin API and the custom component example; done means documenting or demonstrating how the two named plugins are supplied and confirming the resulting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.