Skip to content

Instantly share code, notes, and snippets.

@rayrutjes
Created August 15, 2017 11:49
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/950c17df84fd6a96500f4354878b0a98 to your computer and use it in GitHub Desktop.
Save rayrutjes/950c17df84fd6a96500f4354878b0a98 to your computer and use it in GitHub Desktop.
Programatically refine on category in Vue InstantSearch
<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