docsearch
docsearch copied to clipboard
Initializing Docsearch more than once creates multiple overlapping autocomplete drop downs
Do you want to request a feature or report a bug? Feature
What is the current behavior?
When calling window.docsearch({...options})
multiple times, multiple autocomplete dropdowns are added to the UI.
If the current behavior is a bug, please provide all the steps to reproduce and a minimal
[JSFiddle][3] example or a repository on GitHub that we can npm install
and npm start
.
What is the expected behavior?
I need to be able to apply filters to the search based on user selection. I'm not sure if this is currently possible. I have tried to call window.docsearch({...options})
when the user picks a category to search by, but that seems to add multiple autocomplete dropdowns instead of refreshing the current instance. It would be nice if you could refresh the autocomplete dropdown with results from a newly filtered index.
If I understand correctly, you want to target another DocSearch index after a user interaction. Since the API doesn't allow you to change the index, you tried adding two instances of docsearch
in the same container, and each instance are appended instead of replaced. Is that right?
If I got that wrong, it would be helpful to reproduce the behavior in this DocSearch sandbox.
@francoischalifour Yes that is correct. Thank you for rephrasing that.
That is not possible with the current API. However, you can run two instances of DocSearch and hide/remove the ones with the previous options.
Thanks for the feedback, this is something that we might want to cover in the next version.
I would very much like to have a api that uninstalls docsearch instance. My project will switch multiple docsearch instance according to the language.