Patch-Source: https://github.com/meilisearch/meilisearch/pull/2773 -- From 935f18efcfbad0196eb615bebfe7a71b7ea76bd4 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Wed, 14 Sep 2022 20:57:13 +0200 Subject: [PATCH 2/2] Allow building without specialized tokenizations (Some of) these specialized tokenizations include huge dictionaries that currently account for 90% (!) of the meilisearch binary size. This commit adds chinese, hebrew, japanese, and thai feature flags that are propagated via milli down to the charabia crate. To keep it backward compatible, they are enabled by default. Related to meilisearch/milli#632 --- meilisearch-auth/Cargo.toml | 2 +- meilisearch-http/Cargo.toml | 8 ++++++-- meilisearch-lib/Cargo.toml | 18 +++++++++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/meilisearch-auth/Cargo.toml b/meilisearch-auth/Cargo.toml index 470d5b8d1..3bbc09c4a 100644 --- a/meilisearch-auth/Cargo.toml +++ b/meilisearch-auth/Cargo.toml @@ -10 +10 @@ edition = "2021" -milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.33.5" } +milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.33.5", default-features = false } diff --git a/meilisearch-http/Cargo.toml b/meilisearch-http/Cargo.toml index 38f9a83fc..baea8b578 100644 --- a/meilisearch-http/Cargo.toml +++ b/meilisearch-http/Cargo.toml @@ -49 +49 @@ jsonwebtoken = "8.0.1" -meilisearch-lib = { path = "../meilisearch-lib" } +meilisearch-lib = { path = "../meilisearch-lib", default-features = false } @@ -90,7 +90,7 @@ urlencoding = "2.1.0" yaup = "0.2.0" [features] -default = ["analytics", "mini-dashboard"] +default = ["analytics", "meilisearch-lib/default", "mini-dashboard"] metrics = ["prometheus"] analytics = ["segment"] mini-dashboard = [ @@ -105,4 +105,8 @@ mini-dashboard = [ "zip", ] +chinese = ["meilisearch-lib/chinese"] +hebrew = ["meilisearch-lib/hebrew"] +japanese = ["meilisearch-lib/japanese"] +thai = ["meilisearch-lib/thai"] [package.metadata.mini-dashboard] diff --git a/meilisearch-lib/Cargo.toml b/meilisearch-lib/Cargo.toml index de967286c..bda3ecbc7 100644 --- a/meilisearch-lib/Cargo.toml +++ b/meilisearch-lib/Cargo.toml @@ -31 +31 @@ lazy_static = "1.4.0" -milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.33.5" } +milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.33.5", default-features = false } @@ -64,3 +64,19 @@ nelson = { git = "https://github.com/meilisearch/nelson.git", rev = "675f1388554 paste = "1.0.6" proptest = "1.0.0" proptest-derive = "0.3.0" + +[features] +# all specialized tokenizations +default = ["milli/default"] + +# chinese specialized tokenization +chinese = ["milli/chinese"] + +# hebrew specialized tokenization +hebrew = ["milli/hebrew"] + +# japanese specialized tokenization +japanese = ["milli/japanese"] + +# thai specialized tokenization +thai = ["milli/thai"]