Created
August 15, 2017 11:49
-
-
Save rayrutjes/950c17df84fd6a96500f4354878b0a98 to your computer and use it in GitHub Desktop.
Programatically refine on category 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> | |
<ais-index :search-store="searchStore"> | |
<!-- your other components here --> | |
</ais-index> | |
</template> | |
<script> | |
import { | |
createFromAlgoliaCredentials, | |
FACET_OR, | |
} from 'vue-instantsearch'; | |
const store = createFromAlgoliaCredentials( | |
'<app-id>', | |
'<api-key>' | |
); | |
store.indexName = '<index-name>'; | |
store.addFacet('category_id', FACET_OR); | |
store.addFacetRefinement('category_id', /* put your current category ID here */); | |
export default { | |
data() { | |
return { searchStore: store } | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment