Vue-InstantSearch and Autocomplete.js

When using Vue-InstantSearch is it necessary to have the autocomlete.js script when building out a autocomplete drop-down for a site search?

Hi @jhamilton,

No you don’t have to integrate the autocomlete.js library. But Vue InstantSearch doesn’t provide a built in component out of the box for that use case. You must implement it on your own. You can found a guide on the documentation explaining how to do that.

Hope that helps, let me know if you have some questions :wink:

Thank you @samuel.vaillant

Hey @samuel.vaillant :wave:
Could Vue-InstantSearch be hooked up to vue2-autocomplete-js as the autocomplete component? Thanks for any additional direction. :slight_smile:

Hi @jhamilton,

Sorry for the late answer.

I don’t think this component can be hooked since it’s required pass the URL in order to fetch the data. In Vue InstantSearch this logic is implemented for you. For build a custom autocomplete component you will need to access the current query and the results.

Here is a very basic example with a different library vue-autosuggest. This library only handle the view part and not all the logic behind the request. You only need to pass the current results in order to display suggestions. You can find the example on CodeSandbox.

I picked this library but there are a lots of alternatives, feel free to pick a different one. The concepts will remain the same with another one.

No worries @samuel.vaillant, Thank you so much for providing the example, seeing it definitely helps me understand.


They have some example?