Created
August 16, 2017 16:28
-
-
Save rayrutjes/b32a0db4ce4da32cc2356ca063f5a0ec to your computer and use it in GitHub Desktop.
Aggregate results of multiple indices in Vue InstantSearch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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