11220 Commits

Author SHA1 Message Date
meili-bors[bot]
82912e191b
Merge #5418
5418: Cache embeddings in search r=Kerollmops a=dureuill

# Pull Request

## Related issue
TBD

## What does this PR do?
- Adds a cache for embeddings produced in search
- The cache is disabled by default, and can be enabled following the instructions [here](https://github.com/orgs/meilisearch/discussions/818).
- Had to accommodate the `timeout` test for openai that uses a mock that simulates a timeout on subsequent responses: since the test was reusing the same query, the cache would kick-in and no request would be made to the mock, meaning no timeout any longer and so a failing test 😅 
- `Embedder::embed_search` now accepts a reference instead of an owned `String`.

## Manual testing

- I created 4 indexes on a fresh DB with the same settings (one embedder from openai)
- I sent 1/4 of movies.json to each index
- I sent a federated search request against all 4 indexes, with the same query for each index, using the embedder of each index.

Results:

- The first call took 400ms to 1s. Before this change, it took in the 3s range.
- Any repeated call with the same query took in the range of 25ms.
- Looking at the details at trace log level, I can see that the first index that needs the embedding is taking most of the 400ms in `embed_one`. The other indexes report that the query text is found in the cache and they each take a few µs.

Co-authored-by: Louis Dureuil <louis@meilisearch.com>
2025-03-13 16:37:15 +00:00
Louis Dureuil
e2d372823a
Disable the cache by default and make it experimental 2025-03-13 17:22:51 +01:00
Louis Dureuil
1876132172
Mutex-based implementation 2025-03-13 17:22:50 +01:00
Louis Dureuil
d0b0b90d17
fixup tests, in particular foil the cache for the timeout test 2025-03-13 17:22:50 +01:00
Louis Dureuil
b08544e86d
Add embedding cache 2025-03-13 17:22:50 +01:00
Louis Dureuil
d9111fe8ce
Add lru crate to milli again 2025-03-13 17:22:50 +01:00
Clément Renault
7df5715d39
Merge pull request #5406 from meilisearch/bump-heed
Bump heed to v0.22 and arroy to v0.6
2025-03-13 16:52:45 +01:00
Kerollmops
5fe02ab5e0
Move to heed 0.22 and arroy 0.6 2025-03-13 15:48:18 +01:00
Tamo
5ef7767429 Let arroy uses all the memory available instead of 50% of the 70% 2025-03-13 15:06:03 +01:00
Tamo
3fad48167b remove arroy dependency in the index-scheduler 2025-03-13 14:57:56 +01:00
Clément Renault
a92a48b9b9
Do not recompute stats on dumpless upgrade
Co-authored-by: Tamo <tamo@meilisearch.com>
2025-03-13 13:58:58 +01:00
Tamo
d53225bf64 uses a random seed instead of 42 2025-03-13 12:43:31 +01:00
Kerollmops
20896500c2
Bump arroy to the latest version 2025-03-13 12:37:10 +01:00
Kerollmops
1af520077c
Call the underlying Env::copy_to_path method 2025-03-13 11:49:25 +01:00
Kerollmops
7e07cb9de1
Make meilitool prefer WithoutTls Env 2025-03-13 11:47:19 +01:00
meili-bors[bot]
a12b06d99d
Merge #5369
5369: exhaustive facet search r=ManyTheFish a=ManyTheFish

Fixes #5403

This PR adds an `exhaustiveFacetCount` field to the `/facet-search` API allowing the end-user to have a better facet count when having a distinct attribute set in the index settings.

 # Usage

`POST /index/:index_uid/facet-search`
**Body:**
```json
{
  "facetQuery": "blob",
  "facetName": "genres",
  "q": "",
  "exhaustiveFacetCount": true
}
```

# Prototype Docker images

```sh
$ docker pull getmeili/meilisearch:prototype-exhaustive-facet-search-00
```

Co-authored-by: ManyTheFish <many@meilisearch.com>
2025-03-13 10:36:04 +00:00
Kerollmops
331dc3d241
Add a comment to explain why we keep debug assertions 2025-03-13 11:29:00 +01:00
Tamo
ef9d9f8481
set the memory in arroy 2025-03-13 11:29:00 +01:00
Kerollmops
d3d22d8ed4
Prefer waiting for the task before getting the indexes 2025-03-13 11:29:00 +01:00
Kerollmops
5e6abcf50c
Prefer using WithoutTls for the auth env 2025-03-13 11:29:00 +01:00
Kerollmops
a4aaf932ba
Fix some test (invalid anyway) 2025-03-13 11:29:00 +01:00
Kerollmops
16c962eb30
Enable debug assertions of heed 2025-03-13 11:07:49 +01:00
Kerollmops
55ca2c4481
Avoid opening the Auth environment multiple times 2025-03-13 11:07:49 +01:00
Kerollmops
fedb444e66
Fix the upgrade arroy calls 2025-03-13 11:07:49 +01:00
Kerollmops
bef5954741
Use a WithoutTls env 2025-03-13 11:07:49 +01:00
Kerollmops
ff8cf38d6b
Move to the latest version of arroy 2025-03-13 11:07:48 +01:00
Kerollmops
f8ac575ec5
Move to the latest version of arroy 2025-03-13 11:07:48 +01:00
Kerollmops
566b4efb06
Dumpless upgrade from v1.13 to v1.14 2025-03-13 11:07:44 +01:00
Kerollmops
1d499ed9b2
Use the new arroy upgrade method to move from 0.4 to 0.5 2025-03-13 11:07:44 +01:00
Kerollmops
3bc62f0549
WIP: Still need to introduce a Env::copy_to_path method 2025-03-13 11:07:39 +01:00
Kerollmops
21bbbdec76
Specify WithoutTls everywhere 2025-03-13 11:07:38 +01:00
Kerollmops
78ebd8dba2
Fix the error variants 2025-03-13 11:07:38 +01:00
Kerollmops
34df44a002
Open Env without TLS 2025-03-13 11:07:38 +01:00
Kerollmops
48a27f669e
Bump heed and other dependencies 2025-03-13 11:07:37 +01:00
meili-bors[bot]
e2d0ce52ba
Merge #5384
5384: Get multiple documents by ids r=irevoire a=dureuill

# Pull Request

## Related issue
Fixes #5345 

## What does this PR do?
- Implements [public usage](https://www.notion.so/meilisearch/Get-documents-by-ID-1994b06b651f805ba273e1c6b75ce4d8)
- Slightly refactor error messages for the `/similar` route

Co-authored-by: Louis Dureuil <louis@meilisearch.com>
2025-03-12 17:26:49 +00:00
meili-bors[bot]
995f8962bd
Merge #5398
5398: Bump ring from 0.17.8 to 0.17.13 r=Kerollmops a=dependabot[bot]

Bumps [ring](https://github.com/briansmith/ring) from 0.17.8 to 0.17.13.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/briansmith/ring/blob/main/RELEASES.md">ring's changelog</a>.</em></p>
<blockquote>
<h1>Version 0.17.13 (2025-03-06)</h1>
<p>Increased MSRV to 1.66.0 to avoid bugs in earlier versions so that we can
safely use <code>core::arch::x86_64::__cpuid</code> and <code>core::arch::x86::__cpuid</code> from
Rust in future releases.</p>
<p>AVX2-based VAES-CLMUL implementation. This will be a notable performance
improvement for most newish x86-64 systems. This will likely raise the minimum
binutils version supported for very old Linux distros.</p>
<h1>Version 0.17.12 (2025-03-05)</h1>
<p>Bug fix: <a href="https://redirect.github.com/briansmith/ring/pull/2447">briansmith/ring#2447</a> for denial of service (DoS).</p>
<ul>
<li>
<p>Fixes a panic in <code>ring::aead::quic::HeaderProtectionKey::new_mask()</code> when
integer overflow checking is enabled. In the QUIC protocol, an attacker can
induce this panic by sending a specially-crafted packet. Even unintentionally
it is likely to occur in 1 out of every 2**32 packets sent and/or received.</p>
</li>
<li>
<p>Fixes a panic on 64-bit targets in <code>ring::aead::{AES_128_GCM, AES_256_GCM}</code>
when overflow checking is enabled, when encrypting/decrypting approximately
68,719,476,700 bytes (about 64 gigabytes) of data in a single chunk. Protocols
like TLS and SSH are not affected by this because those protocols break large
amounts of data into small chunks. Similarly, most applications will not
attempt to encrypt/decrypt 64GB of data in one chunk.</p>
</li>
</ul>
<p>Overflow checking is not enabled in release mode by default, but
<code>RUSTFLAGS=&quot;-C overflow-checks&quot;</code> or <code>overflow-checks = true</code> in the Cargo.toml
profile can override this. Overflow checking is usually enabled by default in
debug mode.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/briansmith/ring/commits">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ring&package-manager=cargo&previous-version=0.17.8&new-version=0.17.13)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/meilisearch/meilisearch/network/alerts).

</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-12 13:20:30 +00:00
meili-bors[bot]
1cd00f37c0
Merge #5413
5413: Make sure to delete useless prefixes r=ManyTheFish a=Kerollmops

We discovered a bug where the new indexer was still writing empty roaring bitmaps instead of deleting the prefix entry from the prefix database.

Co-authored-by: Kerollmops <clement@meilisearch.com>
2025-03-12 10:54:04 +00:00
Louis Dureuil
60ff1b19a8
Searching for a document that does not exist no longer raises an error 2025-03-12 11:50:39 +01:00
Louis Dureuil
7df5e3f059
Fix error message
Co-authored-by: Tamo <tamo@meilisearch.com>
2025-03-12 11:48:40 +01:00
Kerollmops
0197dc87e0
Make sure to delete useless prefixes 2025-03-12 11:24:13 +01:00
ManyTheFish
7a172b82ca Add test 2025-03-12 11:22:59 +01:00
ManyTheFish
eb3ff325d1 Add an exhaustiveFacetCount field to the facet-search API 2025-03-12 11:22:59 +01:00
meili-bors[bot]
a2a86ef4e2
Merge #5254
5254: Granular Filterable attribute settings r=ManyTheFish a=ManyTheFish

# Related
**Issue:** https://github.com/meilisearch/meilisearch/issues/5163
**PRD:** https://meilisearch.notion.site/API-usage-Settings-to-opt-out-indexing-features-filterableAttributes-1764b06b651f80aba8bdf359b2df3ca8

# Summary
Change the `filterableAttributes` settings to let the user choose which facet feature he wants to activate or not.
Deactivating a feature will avoid some database computation in the indexing process and save time and disk size.

# Example

`PATCH /indexes/:index_uid/settings`

```json
{
  "filterableAttributes": [
    {
      "patterns": [
        "cattos",
        "doggos.age"
      ],
      "features": {
        "facetSearch": false,
        "filter": {
          "equality": true,
          "comparison": false
        }
      }
    }
  ]
}
```

# Impact on the codebase
- Settings API:
  - `/settings`
  - `/settings/filterable-attributes`
  - OpenAPI 
  - may impact the LocalizedAttributesRules due to the AttributePatterns factorization
- Database:
  - Filterable attributes format changed
  - Faceted field_ids are no more stored in the database
  - FieldIdsMap has no more unexisting fields
- Search:
  - Search using filters
  - Facet search
  - `Attributes` ranking rule
  - Distinct attribute
  - Facet distribution
- Settings reindexing:
  - searchable
  - facet
  - vector
  - geo
- Document indexing:
  - searchable
  - facet
  - vector
  - geo
- Dump import

# Note for the reviewers
The changes are huge and have been split in different commits with a dedicated explanation, I suggest reviewing the commit 1by1

Co-authored-by: ManyTheFish <many@meilisearch.com>
2025-03-12 09:00:43 +00:00
ManyTheFish
d500c7f625 Add default deserialize value 2025-03-11 17:55:49 +01:00
ManyTheFish
ea7e299663 Update has_changed_for_fields documentation 2025-03-11 16:48:55 +01:00
ManyTheFish
a370b467fe Merge MetadataBuilder::_new into MetadataBuilder::new 2025-03-11 15:31:57 +01:00
ManyTheFish
8790880589 Fix clippy 2025-03-11 15:22:39 +01:00
ManyTheFish
7072fe9780 Fix typos in comments and messages 2025-03-11 15:22:00 +01:00
meili-bors[bot]
d0dda78f3d
Merge #5401
5401: Make composite embedders an experimental feature r=irevoire a=dureuill

# Pull Request

## Related issue
Fixes #5343 

## What does this PR do?
- Introduce new `compositeEmbedders` experimental feature
- Guard `source = "composite"` and `searchEmbedder`, `indexingEmbedder` behind enabling the feature.
- Update tests accordingly

## Dumpless upgrade

- Adding an experimental feature is never a breaking change

Co-authored-by: Louis Dureuil <louis@meilisearch.com>
2025-03-11 14:20:36 +00:00
Louis Dureuil
fa8afc5cfd
Style change after review
Co-authored-by: Tamo <tamo@meilisearch.com>
2025-03-11 13:25:35 +01:00