Faceting without prefix

Hello !

I am trying to use faceting to get facets that are not prefixed by my query ( default behavior ).
For instance, when I type “Tour”, I get both “Tours”, “Toulouse”, “Touring” although I only want “Tours” as a result.
Does anyone have an idea ? :confused:
Thank you in advance !

Best regards

Hi @tristan.labetoulle,

Thanks for reaching out with your question!

To give you the best answer, could you help us understand more the data you are working with.

Could you please post an example of your records and their data structure, and then tell us what attributes and values you are trying to match based on your query?

Look forward to hearing back!

Here, when I type “Tour”, I want to get “Tours” but not “Toulouse”

I feel like “Prefix Search” cannot be modified for facet searches

Hi @tristan.labetoulle,

Thanks for the additional detail.

From what I can see in the image, you have a record that has a city attribute that is an array of values such as Toulouse or Tours. The city attribute is also a facet.

If you have a query “tour” and you want to include city:Tours and exclude city:Toulouse you can leverage Query Rules.

Create a Query Rule that says: "If a query contains ‘tour’, set a filter for city:Tours".

You can do this via API or in the Dashboard (Read more here).

API will take JSON:

{
  "condition": {
    "pattern": "tour",
    "anchoring": "contains"
  },
  "consequence": {
    "params": {
      "filters": "city:Tours"
    }
  },
  "description": ""
}

Dashboard you can just use the form:

Here it is working:

I hope this helps!