This month’s release brings you geosearch and support for CSV and NDJSON payloads! You can read the full changelog, but let's take a look at some of the main and breaking changes.

New feature: Geosearch

Meilisearch v0.23 supports geosearch. This allows you to filter and sort results based on their location.

To start using this feature, the _geo field must be present in your indexed documents and added to either the filterableAttributes or sortableAttributes list, depending on the type of operation you’d like to perform.

To filter your results so that they are within a certain area, you can use the built-in _geoRadius filter rule. Let’s say we're in the center of Muscat and want to view restaurants that are within two kilometers:

curl  
    -X POST 'http://localhost:7700/indexes/restaurants/search' \
    --data-binary '{ 
		"filter": "_geoRadius(23.5880, 58.3829, 2000)" 
	}'

_geoRadius establishes a circular area based on a central point and a radius. It requires three parameters: lat, lng, and distance_in_meters—the latitude, longitude, and distance in meters respectively.

You can also sort search results in ascending or descending order based on their distance from a geographic location using _geoPoint. Let’s say you want to order documents based on how close they are to the Eiffel Tower:

curl \
    -X POST 'http://localhost:7700/indexes/restaurants/search' \
	-H 'Content-type:application/json'
	--data-binary '{
	  "sort": "_geoPoint(48.8583701,2.2922926):asc" 
	}`

The search response will return an extra field called _geoDistance. This is the distance in meters computed from the _geoPoint and the _geo coordinates of the search results.

New feature: support for NDJSON and CSV payloads

Meilisearch now accepts CSV and NDJSON along with JSON as data sources. You will now need to specify a Content-Type header for HTTP requests through tools like curl.

Both CSV and NDJSON offer better indexation performance, consume less RAM and are not as CPU-intensive as JSON. NDJSON is easier to validate and, unlike CSV, can handle nested structures.  

Breaking change: Content-Type headers are now mandatory

Since Meilisearch now supports JSON, NDJSON, and CSV, you need to specify content headers for HTTP requests through tools like curl.

  • Content-Type: application/json for JSON
  • Content-Type: application/x-ndjson for NDJSON
  • Content-Type: text/csv for CSV

An example of the JSON header when creating an index:

curl \
    -X POST 'http://localhost:7700/indexes' \
    -H 'Content-Type: application/json' \
    --data-binary '{
      "uid": "movies",
      "primaryKey": "movie_id"
    }'

Contributors

A big thank you to all our contributors! We wouldn't have made it here without your support. This month, we want to send a special shout out to @anirudhRowjee, @felixonmars, @happysalada, @kappa-wingman, @k-nasa, and @shekhirin.


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