MyGit

v1.10.0-rc.0

meilisearch/meilisearch

版本发布时间: 2024-07-29 17:19:05

meilisearch/meilisearch最新发布版本:v1.10.1(2024-09-02 17:59:14)

[!WARNING] Since this is a release candidate (RC), we do NOT recommend using it in a production environment. Is something not working as expected? We welcome bug reports and feedback about new features.

With Meilisearch v1.10 we keep innovating by introducing the really demanded federated search! You can now apply multi-search requests and get one single list of results 🎉. This version also includes a setting to define your index languages (even if multiple languages are in your documents!), and new experimental features like the CONTAINS operator and the ability to update a subset of your dataset by using a simple function.

New features and updates 🔥

Federated search

By using the POST /multi-search endpoint, you can now return a single search result object, whose list of hits is built by merging the hits coming from all the queries in descending ranking score order.

curl \
 -X POST 'http://localhost:7700/multi-search' \
 -H 'Content-Type: application/json' \
 --data-binary '{
  "federation": {
    "offset": 5,
    "limit": 10,
 }
  "queries": [
 {
      "q": "Batman",
      "indexUid": "movies"
 },
 {
      "q": "Batman",
      "indexUid": "comics"
 }
 ]
}'

Response:

{
  "hits": [
    {
      "id": 42,
      "title": "Batman returns",
      "overview": "..",
      "_federation": {
        "indexUid": "movies",
        "queriesPosition": 0
      }
    },
    {
      "comicsId": "batman-killing-joke",
      "description": "..",
      "title": "Batman: the killing joke",
      "_federation": {
        "indexUid": "comics",
        "queriesPosition": 1
      }
    },
    ...
 ],
  processingTimeMs: 0,
  limit: 20,
  offset: 0,
  estimatedTotalHits: 2,
  semanticHitCount: 0,
}

If federation is empty ({}) default values of offset and limit are used, so respectively 0 and 20. If federation is null or missing, a classic multi-search will be applied, so a list of search result objects for each index will be returned.

To customize the relevancy and the weight applied to each index in the search result, use the federationOptions parameter in your request:

curl \
 -X POST 'http://localhost:7700/multi-search' \
 -H 'Content-Type: application/json' \
 --data-binary '{
  "federation": {},
  "queries": [
    {
      "q": "apple red",
      "indexUid": "fruits",
      "filter": "BOOSTED = true",
      "_showRankingScore": true,
      "federationOptions": {
        "weight": 3.0
      }
    },
    {
      "q": "apple red",
      "indexUid": "fruits",
      "_showRankingScore": true,
    }
  ]
}'

weight must be positive (>=0)

📖 More information about the merge algorithm on the here.

Done by @dureuill in #4769.

Experimental: CONTAINS filter operator

Enabling the experimental feature will make a new CONTAINS operator available while filtering on strings. This is similar to the SQL LIKE operator used with %.

Activate the experimental feature:

curl \
 -X PATCH 'http://localhost:7700/experimental-features/' \
  -H 'Content-Type: application/json' \
 --data-binary '{
    "containsFilter": true
 }'

Use the newly introduced CONTAINS operator:

curl \
 -X POST http://localhost:7700/indexes/movies/search \
  -H 'Content-Type: application/json' \
 --data-binary '{
      "q": "super hero",
      "filter": "synopsis NOT CONTAINS spider"
 }'

🗣️ This is an experimental feature, and we need your help to improve it! Share your thoughts and feedback on this GitHub discussion.

Done by @irevoire in #4804.

Languages settings

You can now set up the language of your index in your settings and during the search. This will prevent users from using alternative Meilisearch images we were separately created until now (like for Swedish and Japanese)

Done by @ManyTheFish in #4819.

Index settings

Use the newly introduced localizedAttributes setting (here is an example of handling multi-language documents):

curl \
  -X PATCH 'http://localhost:7700/indexes/movies/settings' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "localizedAttributes": [
      {"locales": ["jpn"], "attributePatterns": ["*_ja"]},
      {"locales": ["eng"], "attributePatterns": ["*_en"]},
      {"locales": ["cmn"], "attributePatterns": ["*_zh"]},
      {"locales": ["fra", "ita"], "attributePatterns": ["latin.*"]},
      {"locales": [], "attributePatterns": ["*"]}
    ]
}'

locales is a list of language codes to assign to a pattern, the supported codes are: epo, eng, rus, cmn, spa, por, ita, ben, fra, deu, ukr, kat, ara, hin, jpn, heb, yid, pol, amh, jav, kor, nob, dan, swe, fin, tur, nld, hun, ces, ell, bul, bel, mar, kan, ron, slv, hrv, srp, mkd, lit, lav, est, tam, vie, urd, tha, guj, uzb, pan, aze, ind, tel, pes, mal, ori, mya, nep, sin, khm, tuk, aka, zul, sna, afr, lat, slk, cat, tgl, hye.

attributePattern is a pattern that can start or end with a * to match one or several attributes.

"locales": [], "attributePatterns": ["*"] means the is the default rule.

Notes:

At search time

The search route accepts a new parameter, locales allowing the end-user to define the language used in the current query:

curl \
 -X POST http://localhost:7700/indexes/movies/search \
  -H 'Content-Type: application/json' \
 --data-binary '{
  "q": "進撃の巨人",
  "locales": ["jpn"]
}'

The locales parameter overrides eventual locales in the index settings.

Experimental: edit documents by using a function

You can edit documents by executing a Rhai function on all the documents of your database or a subset of them that you can select by a Meilisearch filter.

Activate the experimental feature:

curl \
 -X PATCH 'http://localhost:7700/experimental-features/' \
  -H 'Content-Type: application/json' \
 --data-binary '{
    "editDocumentsByFunction": true
 }'

By indexing this movies dataset, you can run the following Rhai function on all of them. This function will uppercase the titles of the movies with an id > 3000 and add sparkles around it. Rhai templating syntax is applied here:

curl http://localhost:7700/indexes/movies/documents/edit \
 -H 'content-type: application/json' \
  -d '{
 "filter": "id > 3000",
 "function": "doc.title = `✨ ${doc.title.to_upper()} ✨`"
 }'

📖 More information here.

🗣️ This is an experimental feature and we need your help to improve it! Share your thoughts and feedback on this GitHub discussion.

Done by @Kerollmops in #4626.

Experimental AI-powered search: quality of life improvements

For the purpose of future stabilization of the feature, we are applying changes and quality-of-life improvements.

Done by @dureuill in #4801, #4815, #4818, #4822.

⚠️ Breaking changes - changing the parameters of the REST API

The old parameters of the REST API are too numerous and confusing.

Removed parameters: query , inputField, inputType, pathToEmbeddings and embeddingObject. Replaced by

Before:

// v1.9 (old) version
{
  "source": "rest",
  "url": "https://localhost:10006",
  "query": {
    "model": "minillm",
 },
  "inputField": ["prompt"],
  "inputType": "text",
  "embeddingObject": ["embedding"]
}
// v1.10 (new) version
{
  "source": "rest",
  "url": "https://localhost:10006",
  "request": {
    "model": "minillm",
    "prompt": "{{text}}"
 },
  "response": {
    "embedding": "{{embedding}}"
 }
}

[!CAUTION] This is a breaking change to the configuration of REST embedders. Importing a dump containing a REST embedder configuration will fail in v1.10 with an error: "Error: unknown field query, expected one of source, model, revision, apiKey, dimensions, documentTemplate, url, request, response, distribution at line 1 column 752".

Upgrade procedure (Cloud):

  1. Remove any embedder with source "rest"
  2. Follow the usual steps described here in the documentation

Upgrade procedure (Open-source users):

  1. Remove any embedder with source "rest"
  2. Follow the usual steps described here in the documentation

Add custom headers to REST embedders

When the source of an embedder is set to rest, headers is now available as an optional parameter.

Previously, the parameter did not exist. Trying to use the headers parameter for any other source is an invalid_settings_embedder error.

Embedding requests sent from Meilisearch to a remote REST embedder always contain two headers:

When provided, headers should be a JSON object whose keys represent the name of additional headers to send in requests, and the values represent the value of these additional headers.

If headers is missing or null for a rest embedder, only Authorization and Content-Type are sent, as described above.

If headers contains Authorization and Content-Type, the declared values will override the ones that are sent by default.

Other quality-of-life improvements

📖 More details here

⚠️ Important change regarding the minimal Ubuntu version compatible with Meilisearch

Because the GitHub Actions runner now enforces the usage of a Node version that is not compatible with Ubuntu 18.04 anymore, we had to upgrade the minimal Ubuntu version compatible with Meilisearch. Indeed, we use these GitHub actions to build and provide our binaries.

Now, Meilisearch is only compatible with Ubuntu 20.04 and later and not with Ubuntu 18.4 anymore.

Done by @curquiza in #4783.

Other improvements

Fixes 🐞

Misc

❤️ Thanks again to our external contributors:

相关地址:原始地址 下载(tar) 下载(zip)

1、 meilisearch-linux-aarch64 113.61MB

2、 meilisearch-linux-amd64 115.1MB

3、 meilisearch-macos-amd64 110.91MB

4、 meilisearch-macos-apple-silicon 109.04MB

5、 meilisearch-windows-amd64.exe 110.82MB

查看:2024-07-29发行的版本