Skip to content

Instantly share code, notes, and snippets.

@rayrutjes
Created August 16, 2017 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rayrutjes/b32a0db4ce4da32cc2356ca063f5a0ec to your computer and use it in GitHub Desktop.
Save rayrutjes/b32a0db4ce4da32cc2356ca063f5a0ec to your computer and use it in GitHub Desktop.
Aggregate results of multiple indices in Vue InstantSearch
<template>
<div>
<ais-index :search-store="searchStore1"></ais-index>
<ais-index :search-store="searchStore2"></ais-index>
<your-map-component :results="combinedResults"></your-map-component>
</div>
</template>
<script>
import { createFromAlgoliaCredentials } from 'vue-instantsearch';
const searchStore1 = createFromAlgoliaCredentials('appId', 'apiKey');
searchStore1.indexName = '<index1>';
const searchStore2 = createFromAlgoliaCredentials('appId', 'apiKey');
searchStore2.indexName = '<index2>';
export default {
data() {
return {
searchStore1,
searchStore2,
}
},
computed() {
combinedResults() {
return searchStore1.results.concat(searchStore2.results);
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment