Support complex queries in the search bar

Hi - I’m wondering if it’s possible to support complex queries directly in the search bar.

The experience I’d like to build would be a hybrid between free-text search and some sort of DSL to support complex queries. If necessary, the user could type some command (e.g. “[query]”) to indicate that they wish to use the DSL.

So if it were a search engine for books, the user might type “Harry Potter” or “[query] category:fiction num_pages>200”.

Obviously your service looks wonderful for the free-text search. And it seems that the plumbing is there for the more complex queries via attributes/filters/facets. But I can’t find an example where that complexity is exposed directly in the search bar.

Is this possible with Algolia?


Thank you for your question!
What you would like to achieve is definitively doable and pretty standard with Algolia!

We would indeed generally approach the problem of implementing a great Search UX with a “visual” UI.

It is however possible to have a more text focused approach, it’s possibly just a matter of how inputs are rendered.

I can see at least 2 possible approaches:

  1. providing an unstructured search input: this will be tricky. Rules can be used to process “tokens” from the search query and transform them into e.g. filters.

  2. providing a structured search with a “query” section, a “filters”, “numeric filters” etc. depending on your data. The idea here would be twofold:

  • minimizing the amount of guess in the user intent;
  • guiding the user as much as possible in her inputs e.g. for filters, you could search for facet values and possibly provide suggestions as if the user use a non-existing value, her search will return no results. Providing a feedback as soon as possible is quite key to building a great UX.

A lot of care should also be taken in properly configuring the search relevance to pick good searchable attributes vs facets. This however is very dependent on the data at hand so we cannot provide much guidance without more details.

I hope that helps!

Hey Marc - thanks for the detailed answer! I’ll give this some thought!