diff --git a/.github/workflows/bench-manual.yml b/.github/workflows/bench-manual.yml index 6d8c3a006..4a9d5fcfd 100644 --- a/.github/workflows/bench-manual.yml +++ b/.github/workflows/bench-manual.yml @@ -18,11 +18,9 @@ jobs: timeout-minutes: 180 # 3h steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: stable - override: true - name: Run benchmarks - workload ${WORKLOAD_NAME} - branch ${{ github.ref }} - commit ${{ github.sha }} run: | diff --git a/.github/workflows/bench-pr.yml b/.github/workflows/bench-pr.yml index 36af79460..6379a528c 100644 --- a/.github/workflows/bench-pr.yml +++ b/.github/workflows/bench-pr.yml @@ -35,11 +35,9 @@ jobs: fetch-depth: 0 # fetch full history to be able to get main commit sha ref: ${{ steps.comment-branch.outputs.head_ref }} - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: stable - override: true - name: Run benchmarks on PR ${{ github.event.issue.id }} run: | diff --git a/.github/workflows/bench-push-indexing.yml b/.github/workflows/bench-push-indexing.yml index fd0f19a5a..dfd1a3b09 100644 --- a/.github/workflows/bench-push-indexing.yml +++ b/.github/workflows/bench-push-indexing.yml @@ -12,11 +12,9 @@ jobs: timeout-minutes: 180 # 3h steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: stable - override: true # Run benchmarks - name: Run benchmarks - Dataset ${BENCH_NAME} - Branch main - Commit ${{ github.sha }} diff --git a/.github/workflows/benchmarks-manual.yml b/.github/workflows/benchmarks-manual.yml index b967eb073..19d477268 100644 --- a/.github/workflows/benchmarks-manual.yml +++ b/.github/workflows/benchmarks-manual.yml @@ -18,11 +18,9 @@ jobs: timeout-minutes: 4320 # 72h steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: stable - override: true # Set variables - name: Set current branch name diff --git a/.github/workflows/benchmarks-pr.yml b/.github/workflows/benchmarks-pr.yml index 30baa294e..6a613dcb9 100644 --- a/.github/workflows/benchmarks-pr.yml +++ b/.github/workflows/benchmarks-pr.yml @@ -13,11 +13,9 @@ jobs: runs-on: benchmarks timeout-minutes: 4320 # 72h steps: - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: stable - override: true - name: Check for Command id: command diff --git a/.github/workflows/benchmarks-push-indexing.yml b/.github/workflows/benchmarks-push-indexing.yml index a966570e6..ae6a4634a 100644 --- a/.github/workflows/benchmarks-push-indexing.yml +++ b/.github/workflows/benchmarks-push-indexing.yml @@ -16,11 +16,9 @@ jobs: timeout-minutes: 4320 # 72h steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: stable - override: true # Set variables - name: Set current branch name diff --git a/.github/workflows/benchmarks-push-search-geo.yml b/.github/workflows/benchmarks-push-search-geo.yml index 1b5cacfd1..8f5f8d020 100644 --- a/.github/workflows/benchmarks-push-search-geo.yml +++ b/.github/workflows/benchmarks-push-search-geo.yml @@ -15,11 +15,9 @@ jobs: runs-on: benchmarks steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: stable - override: true # Set variables - name: Set current branch name diff --git a/.github/workflows/benchmarks-push-search-songs.yml b/.github/workflows/benchmarks-push-search-songs.yml index 02cd10472..a19990e07 100644 --- a/.github/workflows/benchmarks-push-search-songs.yml +++ b/.github/workflows/benchmarks-push-search-songs.yml @@ -15,11 +15,9 @@ jobs: runs-on: benchmarks steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: stable - override: true # Set variables - name: Set current branch name diff --git a/.github/workflows/benchmarks-push-search-wiki.yml b/.github/workflows/benchmarks-push-search-wiki.yml index 455aaa95d..f7da07fda 100644 --- a/.github/workflows/benchmarks-push-search-wiki.yml +++ b/.github/workflows/benchmarks-push-search-wiki.yml @@ -15,11 +15,9 @@ jobs: runs-on: benchmarks steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: stable - override: true # Set variables - name: Set current branch name diff --git a/.github/workflows/flaky-tests.yml b/.github/workflows/flaky-tests.yml index c7e81aacc..d66417c45 100644 --- a/.github/workflows/flaky-tests.yml +++ b/.github/workflows/flaky-tests.yml @@ -16,10 +16,7 @@ jobs: run: | apt-get update && apt-get install -y curl apt-get install build-essential -y - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: helix-editor/rust-toolchain@v1 - name: Install cargo-flaky run: cargo install cargo-flaky - name: Run cargo flaky in the dumps diff --git a/.github/workflows/fuzzer-indexing.yml b/.github/workflows/fuzzer-indexing.yml index 1d01a6ea5..5d1ecc7f8 100644 --- a/.github/workflows/fuzzer-indexing.yml +++ b/.github/workflows/fuzzer-indexing.yml @@ -12,11 +12,9 @@ jobs: timeout-minutes: 4320 # 72h steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: stable - override: true # Run benchmarks - name: Run the fuzzer diff --git a/.github/workflows/publish-apt-brew-pkg.yml b/.github/workflows/publish-apt-brew-pkg.yml index 11893bae0..91b3ecfba 100644 --- a/.github/workflows/publish-apt-brew-pkg.yml +++ b/.github/workflows/publish-apt-brew-pkg.yml @@ -25,10 +25,7 @@ jobs: run: | apt-get update && apt-get install -y curl apt-get install build-essential -y - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: helix-editor/rust-toolchain@v1 - name: Install cargo-deb run: cargo install cargo-deb - uses: actions/checkout@v3 diff --git a/.github/workflows/publish-binaries.yml b/.github/workflows/publish-binaries.yml index 2372ce497..4f475057f 100644 --- a/.github/workflows/publish-binaries.yml +++ b/.github/workflows/publish-binaries.yml @@ -45,10 +45,7 @@ jobs: run: | apt-get update && apt-get install -y curl apt-get install build-essential -y - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: helix-editor/rust-toolchain@v1 - name: Build run: cargo build --release --locked # No need to upload binaries for dry run (cron) @@ -78,10 +75,7 @@ jobs: asset_name: meilisearch-windows-amd64.exe steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: helix-editor/rust-toolchain@v1 - name: Build run: cargo build --release --locked # No need to upload binaries for dry run (cron) @@ -107,12 +101,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - name: Installing Rust toolchain - uses: actions-rs/toolchain@v1 + uses: helix-editor/rust-toolchain@v1 with: - toolchain: stable profile: minimal target: ${{ matrix.target }} - override: true - name: Cargo build uses: actions-rs/cargo@v1 with: @@ -154,12 +146,10 @@ jobs: add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" apt-get update -y && apt-get install -y docker-ce - name: Installing Rust toolchain - uses: actions-rs/toolchain@v1 + uses: helix-editor/rust-toolchain@v1 with: - toolchain: stable profile: minimal target: ${{ matrix.target }} - override: true - name: Configure target aarch64 GNU ## Environment variable is not passed using env: ## LD gold won't work with MUSL diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 84a82250e..7a07997ae 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -31,10 +31,7 @@ jobs: apt-get update && apt-get install -y curl apt-get install build-essential -y - name: Setup test with Rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + uses: helix-editor/rust-toolchain@v1 - name: Cache dependencies uses: Swatinem/rust-cache@v2.7.1 - name: Run cargo check without any default features @@ -59,10 +56,7 @@ jobs: - uses: actions/checkout@v3 - name: Cache dependencies uses: Swatinem/rust-cache@v2.7.1 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: helix-editor/rust-toolchain@v1 - name: Run cargo check without any default features uses: actions-rs/cargo@v1 with: @@ -87,10 +81,7 @@ jobs: run: | apt-get update apt-get install --assume-yes build-essential curl - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: helix-editor/rust-toolchain@v1 - name: Run cargo build with almost all features run: | cargo build --workspace --locked --release --features "$(cargo xtask list-features --exclude-feature cuda)" @@ -110,10 +101,7 @@ jobs: run: | apt-get update apt-get install --assume-yes build-essential curl - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: helix-editor/rust-toolchain@v1 - name: Run cargo tree without default features and check lindera is not present run: | if cargo tree -f '{p} {f}' -e normal --no-default-features | grep -qz lindera; then @@ -137,10 +125,7 @@ jobs: run: | apt-get update && apt-get install -y curl apt-get install build-essential -y - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: helix-editor/rust-toolchain@v1 - name: Cache dependencies uses: Swatinem/rust-cache@v2.7.1 - name: Run tests in debug @@ -154,11 +139,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: 1.75.0 - override: true components: clippy - name: Cache dependencies uses: Swatinem/rust-cache@v2.7.1 @@ -173,10 +156,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: nightly-2024-06-25 override: true components: rustfmt - name: Cache dependencies diff --git a/.github/workflows/update-cargo-toml-version.yml b/.github/workflows/update-cargo-toml-version.yml index 51ab6d1ab..8b6d0a2d2 100644 --- a/.github/workflows/update-cargo-toml-version.yml +++ b/.github/workflows/update-cargo-toml-version.yml @@ -18,11 +18,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: helix-editor/rust-toolchain@v1 with: profile: minimal - toolchain: stable - override: true - name: Install sd run: cargo install sd - name: Update Cargo.toml file diff --git a/Cargo.lock b/Cargo.lock index 3c728f348..156e3d146 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6080,12 +6080,13 @@ dependencies = [ [[package]] name = "yaup" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a59e7d27bed43f7c37c25df5192ea9d435a8092a902e02203359ac9ce3e429d9" +checksum = "b0144f1a16a199846cb21024da74edd930b43443463292f536b7110b4855b5c6" dependencies = [ + "form_urlencoded", "serde", - "url", + "thiserror", ] [[package]] diff --git a/README.md b/README.md index 540a2c92b..d806ed963 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@
⚡ A lightning-fast search engine that fits effortlessly into your apps, websites, and workflow 🔍
-[Meilisearch](https://www.meilisearch.com) helps you shape a delightful search experience in a snap, offering features that work out of the box to speed up your workflow. +[Meilisearch](https://www.meilisearch.com?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=intro) helps you shape a delightful search experience in a snap, offering features that work out of the box to speed up your workflow. -🔥 [**Try it!**](https://where2watch.meilisearch.com/?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=demo-link) 🔥 +## 🖥 Examples + +- [**Movies**](https://where2watch.meilisearch.com/?utm_campaign=oss&utm_source=github&utm_medium=organization) — An application to help you find streaming platforms to watch movies using [hybrid search](https://www.meilisearch.com/solutions/hybrid-search?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=demos). +- [**Ecommerce**](https://ecommerce.meilisearch.com/?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=demos) — Ecommerce website using disjunctive [facets](https://www.meilisearch.com/docs/learn/fine_tuning_results/faceted_search?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=demos), range and rating filtering, and pagination. +- [**Songs**](https://music.meilisearch.com/?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=demos) — Search through 47 million of songs. +- [**SaaS**](https://saas.meilisearch.com/?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=demos) — Search for contacts, deals, and companies in this [multi-tenant](https://www.meilisearch.com/docs/learn/security/multitenancy_tenant_tokens?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=demos) CRM application. + +See the list of all our example apps in our [demos repository](https://github.com/meilisearch/demos). ## ✨ Features -- **Hybrid search:** Combine the best of both [semantic](https://www.meilisearch.com/docs/learn/experimental/vector_search) & full-text search to get the most relevant results -- **Search-as-you-type:** find & display results in less than 50 milliseconds to provide an intuitive experience +- **Hybrid search:** Combine the best of both [semantic](https://www.meilisearch.com/docs/learn/experimental/vector_search?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=features) & full-text search to get the most relevant results +- **Search-as-you-type:** Find & display results in less than 50 milliseconds to provide an intuitive experience - **[Typo tolerance](https://www.meilisearch.com/docs/learn/configuration/typo_tolerance?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=features):** get relevant matches even when queries contain typos and misspellings - **[Filtering](https://www.meilisearch.com/docs/learn/fine_tuning_results/filtering?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=features) and [faceted search](https://www.meilisearch.com/docs/learn/fine_tuning_results/faceted_search?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=features):** enhance your users' search experience with custom filters and build a faceted search interface in a few lines of code - **[Sorting](https://www.meilisearch.com/docs/learn/fine_tuning_results/sorting?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=features):** sort results based on price, date, or pretty much anything else your users need @@ -59,7 +66,7 @@ You can consult Meilisearch's documentation at [meilisearch.com/docs](https://ww ## 🚀 Getting started -For basic instructions on how to set up Meilisearch, add documents to an index, and search for documents, take a look at our [Quick Start](https://www.meilisearch.com/docs/learn/getting_started/quick_start?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=get-started) guide. +For basic instructions on how to set up Meilisearch, add documents to an index, and search for documents, take a look at our [documentation](https://www.meilisearch.com/docs?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=get-started) guide. ## 🌍 Supercharge your Meilisearch experience @@ -83,7 +90,7 @@ Finally, for more in-depth information, refer to our articles explaining fundame ## 📊 Telemetry -Meilisearch collects **anonymized** data from users to help us improve our product. You can [deactivate this](https://www.meilisearch.com/docs/learn/what_is_meilisearch/telemetry?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=telemetry#how-to-disable-data-collection) whenever you want. +Meilisearch collects **anonymized** user data to help us improve our product. You can [deactivate this](https://www.meilisearch.com/docs/learn/what_is_meilisearch/telemetry?utm_campaign=oss&utm_source=github&utm_medium=meilisearch&utm_content=telemetry#how-to-disable-data-collection) whenever you want. To request deletion of collected data, please write to us at [privacy@meilisearch.com](mailto:privacy@meilisearch.com). Remember to include your `Instance UID` in the message, as this helps us quickly find and delete your data. @@ -105,11 +112,11 @@ Thank you for your support! ## 👩💻 Contributing -Meilisearch is, and will always be, open-source! If you want to contribute to the project, please take a look at [our contribution guidelines](CONTRIBUTING.md). +Meilisearch is, and will always be, open-source! If you want to contribute to the project, please look at [our contribution guidelines](CONTRIBUTING.md). ## 📦 Versioning -Meilisearch releases and their associated binaries are available [in this GitHub page](https://github.com/meilisearch/meilisearch/releases). +Meilisearch releases and their associated binaries are available on the project's [releases page](https://github.com/meilisearch/meilisearch/releases). The binaries are versioned following [SemVer conventions](https://semver.org/). To know more, read our [versioning policy](https://github.com/meilisearch/engine-team/blob/main/resources/versioning-policy.md). diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index 213ec3230..0b98cc22a 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -1811,7 +1811,7 @@ mod tests { task_db_size: 1000 * 1000, // 1 MB, we don't use MiB on purpose. index_base_map_size: 1000 * 1000, // 1 MB, we don't use MiB on purpose. enable_mdb_writemap: false, - index_growth_amount: 1000 * 1000, // 1 MB + index_growth_amount: 1000 * 1000 * 1000 * 1000, // 1 TB index_count: 5, indexer_config, autobatching_enabled: true, diff --git a/meilisearch-auth/src/lib.rs b/meilisearch-auth/src/lib.rs index e74f1707c..4dbf1bf6f 100644 --- a/meilisearch-auth/src/lib.rs +++ b/meilisearch-auth/src/lib.rs @@ -188,6 +188,12 @@ impl AuthFilter { self.allow_index_creation && self.is_index_authorized(index) } + #[inline] + /// Return true if a tenant token was used to generate the search rules. + pub fn is_tenant_token(&self) -> bool { + self.search_rules.is_some() + } + pub fn with_allowed_indexes(allowed_indexes: HashSet{ data: D, filters: AuthFilter, @@ -35,12 +37,12 @@ impl
GuardedData
{ let missing_master_key = auth.get_master_key().is_none(); match Self::authenticate(auth, token, index).await? { - Some(filters) => match data { + Ok(filters) => match data { Some(data) => Ok(Self { data, filters, _marker: PhantomData }), None => Err(AuthenticationError::IrretrievableState.into()), }, - None if missing_master_key => Err(AuthenticationError::MissingMasterKey.into()), - None => Err(AuthenticationError::InvalidToken.into()), + Err(_) if missing_master_key => Err(AuthenticationError::MissingMasterKey.into()), + Err(e) => Err(ResponseError::from_msg(e.to_string(), Code::InvalidApiKey)), } } @@ -51,12 +53,12 @@ impl
GuardedData
{ let missing_master_key = auth.get_master_key().is_none(); match Self::authenticate(auth, String::new(), None).await? { - Some(filters) => match data { + Ok(filters) => match data { Some(data) => Ok(Self { data, filters, _marker: PhantomData }), None => Err(AuthenticationError::IrretrievableState.into()), }, - None if missing_master_key => Err(AuthenticationError::MissingMasterKey.into()), - None => Err(AuthenticationError::MissingAuthorizationHeader.into()), + Err(_) if missing_master_key => Err(AuthenticationError::MissingMasterKey.into()), + Err(_) => Err(AuthenticationError::MissingAuthorizationHeader.into()), } } @@ -64,7 +66,7 @@ impl
GuardedData
{
auth: Data