After the full rewrite of the core engine required by v0.21, we are finally back on track with our monthly release schedule. You can read the full changelog, but let's take a look at some of the new version's main changes.

New feature: sorting at search time

Though Meilisearch already allowed developers to influence the sorting process by creating custom ranking rules, this was something done during index configuration and applied to all searches in that index. Allowing users to change sorting order and parameters, also known as sorting at search time, was a cumbersome task that required plenty of workarounds like creating several indexes with slightly different ranking rules.

With the introduction of the sortableAttributes index setting, the sort search parameter and the "sort" ranking rule, users can now sort results by document field values in ascending or descending order at search time.

To sort at search time, you must first update the sortableAttributes index setting. We currently support attributes containing strings and numbers:

$ curl \
	-X POST 'http://localhost:7700/indexes/books/settings/sortable-attributes' \
	--data '[
			"price",
			"author"
	]'

Once sortableAttributes has been configured, you can use the sort search parameter to sort results at search time. sort requires a list of attributes given in the attribute:sorting_order format:

$ curl \
  -X POST 'http://localhost:7700/indexes/books/search' \
  --data '{
    "q": "science fiction",
    "sort": [
      "price:asc"
    ]
  }'

For more information on sorting, take a look at our dedicated guide.

Breaking change: custom ranking rules

We have aligned the syntax for custom ranking rules and sort:

# current syntax
"price:asc"

# old syntax
"asc(price)"

Custom ranking rules are still the best way of promoting specific types of documents on every search, like when you want to make sure discounted products always feature in a webshop's top search results.

New indexer

Our second major change on v0.22 should actually be quite invisible. We have refactored our indexer, solving many long-standing issues regarding crashes due to memory overconsumption.

The transition to the new indexer should be completely seamless and require no change on your side. Barring any hidden bugs, the only thing you should notice is that indexation is faster and that crashes have become much, much more rare. If you want to know more about indexation and performance, we have added a new article to our documentation.

In case you still experience issues during indexation, let us know (and check the FAQ for some of our recommended fixes)!

Other changes

  • We no longer use Sentry to collect usage data from instances
  • Custom ranking rules now work on strings as well as numbers
  • The default installation script available at https://install.meilisearch.com now works with Windows machines using Cygwin or an equivalent environment

Contributors

We wouldn't have gotten here without the support from our community. You're really, truly great and we can't thank you enough for all the effort, suggestions, comments and time you dedicate to Meilisearch. This month, we want to send a special thank you to @sanders41, @bb, and @shekirin.


And that's all for v0.22! Remember to check out the changelog for the full release notes and see you again next month!