Default filters on page load

Hello,
I need to set default filter on page load, all records in your database have attribute “product”, but it’s not working :frowning:

var search = instantsearch({
	appId: algolia.application_id,
	apiKey: algolia.search_api_key,
	indexName: algolia.indices.searchable_posts.name,
	urlSync: {
		mapping: {'q': 's'},
		trackedParameters: ['query']
	},
	searchParameters: {
		facetingAfterDistinct: true,
		highlightPreTag: '__ais-highlight__',
		highlightPostTag: '__/ais-highlight__',
		filters: 'product:329'
	}
});

What I did wrong? I’ve added just one line “filters: ‘product:329’”

Help please

Hi,

Have you set product as an “attribute for faceting” in your dashboard?

Julien

Hello,
thanks, yes I did, but just in one table and that was the problem
now it works :wink:

1 Like