How to define a query rule using filter matching attribute and an operand

Is there a way to define a query rule using “filter matching attribute” in conjuction with an operand?
For example, if the client will make a voice search “villa for sale with minimum 4 rooms” i want to define somehow a query rule but to use an operand.

Any ideas? See image below.


Hi @Mikhi,

Thanks for contacting Algolia.

We appreciate the sample query you provided of:

"villa for sale with minimum 4 rooms"

Can you give more detail of what you would expect to happen - for example:

  • What would your example Algolia record look like?
  • What attribute values would successfully match or filter out?

Walking us through an explicit example will be helpful in letting us know what UX you want to achieve (with voice) and if it is doable. Thanks!

Hi David,

Thanks for your reply.

My goal was to find a solution to detect the intent of the user based on query term:
(villa for sale with minimum 4 rooms"
for which we have to return villas with 4,5,6,7,8,9…20 rooms and apply a facet “rooms >=4”

With this in mind, i’ve created several query rules to match some use cases. One of them is the image provided above. But there i don’t have the option to specify the operand >=. The operand in this case is always “=”

Hi @Mikhi,

For your Consequence, consider using “Add Query Parameter” then you can manually create your JSON filter:

This way you can use your boolean filters like “>=” . I hope this helps

But what if the user will type 2 rooms, or 3 rooms, do i have to create another query rule to match the entered number? Unfortunately this approach will lead to “nxn” query rules for the same intent.

The “query parameter” will be a good solution only if i would be able to bind the query number rooms in a dynamic way.

As i see, at this moment i cannot use the query rules options in this way.

I hope this feature may be considered an improvement for query rules, and Algolia will take into consideration in feature releases.

In few words, i would like to be able to have an dynamic query rule option.