We’re thrilled to announce the release of Meilisearch v1.2. This minor version comprises new features for filters and engine improvements across the board. Let’s dig into the most noteworthy changes!

New feature: enhanced document management with filters

We’re excited to improve Meilisearch developers' experience by introducing filters for fetching and deleting documents. 🥳

ℹ️
As always with filters, document fields must first be set as filterable attributes.

Retrieving documents

Filters bring new capabilities to fetching documents. For example, we could check how many documents match some filters before performing a deletion.

So we’re introducing a new endpoint to retrieve documents:

POST /indexes/{indexUid}/documents/fetch

Let’s consider an index that contains movies. We will write a request to retrieve 10 movies from the Horror or Mystery genre. Using the array syntax, we can express the filters in the request body as following:

{
  "filter": [
    "genre = Horror",
    "genre = Mystery"
  ],
  "limit": 10
}

This new endpoint saves you from having to make a search request to explore your data. Read more about fetching documents using filters in the dedicated docs.

Deleting documents

You can now delete documents matching a list of filters. This feature comes with a dedicated endpoint:

POST /indexes/{indexUid}/documents/delete

Taking the example of an index that contains movies, let’s write a request to delete all Horror or Comedy movies, as well as movies directed by James Cameron. This can expressed with the following request body:

{
  "filter": [
    [ "genre = Horror", "genre = Comedy" ],
    "director = \"James Cameron\""
  ]
}

This requests launches a task to delete matching documents. Meilisearch will respond with a summarized task object:

{
  "taskUid": 42,
  "indexUid": "movies",
  "status": "enqueued",
  "type": "documentDeletion",
  "enqueuedAt": "2023-06-05T11:01:58.721841Z"
}

This task represents the asynchronous deletion operation. Don’t forget to check the task status to ensure that documents have been deleted before proceeding. Read more about deleting documents in the dedicated docs.

New feature: IS EMPTY and IS NULL filter operators

This release gives new powers to filters. So we thought, how can we go further? Maybe if we could filter in even more ways. I mean, don’t you want some more filters with your filtering?

So, we’re introducing two new filter operators: IS EMPTY and IS NULL. IS EMPTY matches existing attributes with empty value while IS NULL  matches fields with a null value.

Here’s an example considering the following documents:

[
  {
    "id": 0,
    "color": []
  },
  {
    "id": 1,
    "color": null
  },
  {
    "id": 2,
  }
]

The new filter operators work like this:

  • color IS EMPTY: matches document 0
  • color IS NULL: matches document 1

Note that neither IS EMPTY nor IS NULL matches documents missing the color field. Both operators can also be used in conjunction with NOT. Read more in the related documentation.

Experimental feature: reducing memory usage

We’re introducing a new experimental flag to decrease the RAM usage of Meilisearch. Try it by launching Meilisearch with the --experimental-reduce-indexing-memory-usage CLI flag or the MEILI_EXPERIMENTAL_REDUCE_INDEXING_MEMORY_USAGE environment variable.

You can give feedback on this Github discussion.

Improvement: relevancy

We’ve enhanced typo tolerance. Split words are now considered a typo, meaning whit ehorse may now match documents containing white horse. However, n-grams and split words will now rank lower. This means that sun flower will now return a document containing Sun Flower before one with Sunflower.

Improvement: automated task deletion

Meilisearch handles operations like adding documents to an index asynchronously. This means they are not handled immediately. Instead, Meilisearch places them in a tasks queue and processes them in the order they were received. Starting with v1.2, the maximum capacity of the task queue is 1 million.

Once the queue is full, Meilisearch will try to delete the oldest 100,000 tasks. Meilisearch will not remove tasks that are not finished (enqueued or processing). It will simply delete as many finished tasks as possible among the 100,000 oldest.

ℹ️
When automatic deletion fails for a task, Meilisearch will issue logs with `warning` levels.

Other changes

  • Updated how Meilisearch handles ranking rules to improve search consistency and latency
  • Geosearch sorting is now more performant for both descending and ascending sort
  • Enhanced language support for Latin languages and Arabic thanks to charabia update

Conclusion

This wraps up the biggest changes in Meilisearch v1.2. For an exhaustive review, including security updates and bug fixes, consult the changelog.

We’re already preparing version 1.3 of Meilisearch. We already have three prototypes ready for you to play with: search for facet values, sorting facet values, and the  CONTAINS,  STARTS WITH, and ENDS WITH filter operators. We’re eager to hear from you to nail the finishing touches.

This release wouldn’t be possible without the contributions of @cymruu, @GregoryConrad, @inductor, @jirutka, @jlucktay, @roy9495, and @Sufflope to meilisearch. This also includes the work of @akeamc, @DrAliRagab, @goodhoko, and @mosuka who contributed to the last release of charabia to keep improving language support. Massive thanks to our awesome contributors. 🫶

You can stay in the loop by subscribing to our newsletter. To learn more about Meilisearch's future and help shape it, take a look at our roadmap and come participate in our Product Discussions.

Join the discussion on /r/rust.

For anything else, join our developers community on Discord.

I’ll see you there.