Autocomplete doesn't handle multiple queries correctly
Describe the bug If you select multiple indices to be used in autocomplete, each index is queried in a separate request. Algolia's current pricing model charges by the individual network request. So every time a search is performed in an autocomplete with 2+ indices, the charges will be multiplied.
The problematic code is here.
To resolve this, we should be creating the hits using autocomplete sources. See the example code here.
Expected behavior If an autocomplete queries 2+ indices, each keystroke should trigger one single network request. Each request will be an array of queries. See more info about Algolia multi-queries here.
We noticed this as well. It looks like the autocomplete hits source no longer works with the latest version of algoliasearch (v4) though (see note https://github.com/algolia/autocomplete/tree/v0.38.0#standalone), although I didn't test it to see for sure, I just assumed it wouldn't.
We instead went the route of using the multipleQueries API and used our own response "cache" to prevent query from running more than once per character entered.
Full code here as an example. It doesn't cover every case, but it works well enough for us now.
Thanks for sharing this @coreyworrell