Predefined search

I want to return objects that have a boolean value on a variable and display it on a tab and the user should not be able to change this query. Is this possible?

Sure thing. We have a feature called Secured API Keys.

They are actually API keys with some filters baked in. You could create such a key with a filter on your boolean value and then all queries that will be done with this key will have this filter integrated. Users won’t be able to override it.

It’s usually used for queries where you have “premium” and non-“premium” users and you want only your premium users to be able to see some specific content. To do that you use a specific key for non-premium users that is more restrictive, and a another with more flexibility for the premium ones.

Awesome! So for example if I want to display a list of Featured content that has a boolean Featured set to true, I would use the Secured API Keys to create that list of content then display it the same way?

I’m kinda new to this so I’m trying to wrap my head around it.

var searchOnlyApiKey = ‘KEY’;
var params = {
hitsPerPage: 24,
filters: ‘Featured = True’
var publicKey = client.generateSecuredApiKey(searchOnlyApiKey, params);

But then I wouldn’t want the user to be able to search through these results, just view what I give them. That is where I am not understanding from that walkthrough because it looks like you still give then searchable content.

maybe this will be easy to ask.

Can I put a filter into this query so that I only values back with a certain variable “Featured” that is “true”?

container: ‘#hits’,
hitsPerPage: 24,
templates: {
item: document.getElementById(‘hit-template’).innerHTML,
empty: “We didn’t find any results for the search “{{query}}”