Created
April 18, 2019 04:32
-
-
Save seandogg/df6288edf9dd8e72c9d376ca16c00022 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
search: instantsearch({ | |
appId: algolia.config.app_id, | |
apiKey: algolia.config.search_api_key, | |
indexName: '' + algolia.config.index_prefix + 'products', | |
searchParameters: { | |
clickAnalytics: true | |
}, | |
urlSync: {}, | |
searchFunction: function (searchFunctionHelper) { | |
// Set query parameters here because they're not kept when someone | |
// presses the Back button if set in the `init` function of a custom widget | |
var helper = instant.search.helper; | |
var page = helper.getPage(); | |
helper.setQueryParameter('highlightPreTag', '<span class="ais-highlight">'); | |
helper.setQueryParameter('highlightPostTag', '</span>'); | |
if (instant.distinct) { | |
helper.setQueryParameter('distinct', true); | |
} | |
if (!!collectionFacetConstraint && !!collectionFacetValue) { | |
helper.setQueryParameter('filters', 'collections:"' + collectionFacetValue + '"'); | |
} | |
if (!!collectionFacetValue) { | |
helper.setQueryParameter('ruleContexts', [ collectionFacetValue ]); | |
} | |
helper.setPage(page); | |
searchFunctionHelper.search(); | |
} | |
}), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment