Making Chinese and Japanese search indexing optional... (#1115)

* This can shave ~80 MB off the binary size while allowing users
  speaking these two languages to easily switch them back on
This commit is contained in:
liushuyu 2020-08-07 09:03:51 -06:00 committed by GitHub
parent 4a3c1568a2
commit 6af7959fce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 0 deletions

1
Cargo.lock generated
View file

@ -2817,6 +2817,7 @@ dependencies = [
"notify", "notify",
"open", "open",
"rebuild", "rebuild",
"search",
"site", "site",
"termcolor", "termcolor",
"tokio", "tokio",

View file

@ -41,6 +41,7 @@ errors = { path = "components/errors" }
front_matter = { path = "components/front_matter" } front_matter = { path = "components/front_matter" }
utils = { path = "components/utils" } utils = { path = "components/utils" }
rebuild = { path = "components/rebuild" } rebuild = { path = "components/rebuild" }
search = { path = "components/search" }
[workspace] [workspace]
members = [ members = [

View file

@ -12,3 +12,8 @@ lazy_static = "1"
errors = { path = "../errors" } errors = { path = "../errors" }
library = { path = "../library" } library = { path = "../library" }
config = { path = "../config" } config = { path = "../config" }
[features]
default = []
indexing-zh = ["elasticlunr-rs/zh"]
indexing-ja = ["elasticlunr-rs/ja"]

View file

@ -20,6 +20,12 @@ languages = [
If you want to use per-language taxonomies, ensure you set the `lang` field in their If you want to use per-language taxonomies, ensure you set the `lang` field in their
configuration. configuration.
Note: By default, Chinese and Japanese search indexing is not included. You can include
the support by building `zola` using `cargo build --features search/indexing-ja search/indexing-zh`.
Please also note that, enabling Chinese indexing will increase the binary size by approximately
5 MB while enabling Japanese indexing will increase the binary size by approximately 70 MB
due to the incredibly large dictionaries.
## Content ## Content
Once the languages have been added, you can start to translate your content. Zola Once the languages have been added, you can start to translate your content. Zola
uses the filename to detect the language: uses the filename to detect the language: