How can i create a query rule for any empty query?

I’d like to promote a result when the query term is empty

Hi @aequasi,

As of today, this isn’t something we can do out of the box (we’re aware that it’s an issue and we have plans to address it - although I can’t give you a timeline on that). One way of imitating this behaviour, is to always send queries to algolia with a “token” word that you can remove with a query rule. E.g, if a customer searches for “shirts”, you’d use the Algolia API to send “token shirts” to Algolia. The query rule would remove the word “token”, and just search with the query “shirts”.

When an “empty” search query is sent to Algolia, what we’ll actually see is a query “token”, for which you can add another query rule to act upon. E.g, promote a specific result.

The downside to all this is that your analytics will be filled with search terms prefixed with “token”, and so you won’t have the original clean data set that we’d usually like to see through Analytics.

Let me know if any of this is unclear and I’ll be happy to help you out further.

Cheers,
Aaron

2 Likes

I was afraid of that. Thank you though! I may just have to look into more explicit boosting