Compare commits

...

12 Commits

Author SHA1 Message Date
c0a608fd15 Change jayson and milli dependencies to the public git repos 2022-06-22 17:54:58 +02:00
b014bab716 Check validity of settings with jayson in a more convenient way 2022-06-22 17:04:17 +02:00
594f56ffe0 Update Cargo.lock 2022-06-22 17:03:40 +02:00
8536d4448a Tidy up code 2022-06-22 16:15:10 +02:00
c713bd2a9c Update some tests to reflect changes due to Jayson integration 2022-06-22 16:02:38 +02:00
73845f87cf Fix loading of dump v2 by patching ranking rules inside update settings 2022-06-22 15:32:17 +02:00
496a27f4a2 Fix content of dump/assets for testing
Some contained settings with the criterion desc(fame), which is invalid
for a v3 or higher dump.

The change took place in the updates.json file inside the decompressed
.dump files. Instances of desc(field) or asc(field) were changed to 
field:desc and field:asc
2022-06-22 15:02:49 +02:00
ff564f6d05 WIP jayson integration 2022-06-22 15:02:39 +02:00
4c1f034d9f Remove Checked/Unchecked type parameter from Settings type 2022-06-21 15:34:53 +02:00
b84ea036dd Continue integrating Jayson 2022-06-21 14:40:48 +02:00
ba82584328 Start jayson integration 2022-06-21 12:16:25 +02:00
9082679609 Add Jayson actix-web extractor 2022-06-20 17:39:48 +02:00
26 changed files with 611 additions and 396 deletions

408
Cargo.lock generated
View File

@ -36,9 +36,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-http" name = "actix-http"
version = "3.0.4" version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5885cb81a0d4d0d322864bea1bb6c2a8144626b4fdc625d4c51eba197e7797a" checksum = "bd2e9f6794b5826aff6df65e3a0d0127b271d1c03629c774238f3582e903d4e4"
dependencies = [ dependencies = [
"actix-codec", "actix-codec",
"actix-rt", "actix-rt",
@ -62,13 +62,13 @@ dependencies = [
"itoa 1.0.2", "itoa 1.0.2",
"language-tags", "language-tags",
"local-channel", "local-channel",
"log",
"mime", "mime",
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rand", "rand",
"sha-1", "sha1",
"smallvec", "smallvec",
"tracing",
] ]
[[package]] [[package]]
@ -77,8 +77,8 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6" checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6"
dependencies = [ dependencies = [
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -165,9 +165,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-web" name = "actix-web"
version = "4.0.1" version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4e5ebffd51d50df56a3ae0de0e59487340ca456f05dd0b90c0a7a6dd6a74d31" checksum = "a27e8fe9ba4ae613c21f677c2cfaf0696c3744030c6f485b34634e502d6bb379"
dependencies = [ dependencies = [
"actix-codec", "actix-codec",
"actix-http", "actix-http",
@ -200,20 +200,20 @@ dependencies = [
"serde_urlencoded", "serde_urlencoded",
"smallvec", "smallvec",
"socket2", "socket2",
"time 0.3.9", "time 0.3.11",
"url", "url",
] ]
[[package]] [[package]]
name = "actix-web-codegen" name = "actix-web-codegen"
version = "4.0.0" version = "4.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7525bedf54704abb1d469e88d7e7e9226df73778798a69cea5022d53b2ae91bc" checksum = "5f270541caec49c15673b0af0e9a00143421ad4f118d2df7edcb68b627632f56"
dependencies = [ dependencies = [
"actix-router", "actix-router",
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -285,9 +285,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.57" version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704"
dependencies = [ dependencies = [
"backtrace", "backtrace",
] ]
@ -318,9 +318,9 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -329,9 +329,9 @@ version = "0.1.56"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -544,9 +544,9 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -563,9 +563,9 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]] [[package]]
name = "bytestring" name = "bytestring"
version = "1.0.0" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90706ba19e97b90786e19dc0d5e2abd80008d99d4c0c5d1ad0b5e72cec7c494d" checksum = "86b6a75fd3048808ef06af5cd79712be8111960adaf89d90250974b38fc3928a"
dependencies = [ dependencies = [
"bytes", "bytes",
] ]
@ -680,16 +680,16 @@ checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e"
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.1.18" version = "3.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" checksum = "9f1fe12880bae935d142c8702d500c63a4e8634b6c3c57ad72bf978fc7b6249a"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
"clap_derive", "clap_derive",
"clap_lex", "clap_lex",
"indexmap", "indexmap",
"lazy_static", "once_cell",
"strsim", "strsim",
"termcolor", "termcolor",
"textwrap", "textwrap",
@ -697,22 +697,22 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "3.1.18" version = "3.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c" checksum = "ed6db9e867166a43a53f7199b5e4d1f522a1e5bd626654be263c999ce59df39a"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error", "proc-macro-error",
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.2.0" version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" checksum = "87eba3c8c7f42ef17f6c659fc7416d0f4758cd3e58861ee63c5fa4a4dde649e4"
dependencies = [ dependencies = [
"os_str_bytes", "os_str_bytes",
] ]
@ -723,9 +723,9 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1df715824eb382e34b7afb7463b0247bf41538aeba731fba05241ecdb5dc3747" checksum = "1df715824eb382e34b7afb7463b0247bf41538aeba731fba05241ecdb5dc3747"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -734,6 +734,12 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "convert_case"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8"
[[package]] [[package]]
name = "cookie" name = "cookie"
version = "0.16.0" version = "0.16.0"
@ -741,7 +747,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94d4706de1b0fa5b132270cddffa8585166037822e260a944fe161acd137ca05" checksum = "94d4706de1b0fa5b132270cddffa8585166037822e260a944fe161acd137ca05"
dependencies = [ dependencies = [
"percent-encoding", "percent-encoding",
"time 0.3.9", "time 0.3.11",
"version_check", "version_check",
] ]
@ -810,12 +816,12 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-channel" name = "crossbeam-channel"
version = "0.5.4" version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"crossbeam-utils 0.8.8", "crossbeam-utils 0.8.9",
] ]
[[package]] [[package]]
@ -826,20 +832,20 @@ checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"crossbeam-epoch", "crossbeam-epoch",
"crossbeam-utils 0.8.8", "crossbeam-utils 0.8.9",
] ]
[[package]] [[package]]
name = "crossbeam-epoch" name = "crossbeam-epoch"
version = "0.9.8" version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"crossbeam-utils 0.8.8", "crossbeam-utils 0.8.9",
"lazy_static",
"memoffset", "memoffset",
"once_cell",
"scopeguard", "scopeguard",
] ]
@ -864,12 +870,12 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.8" version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" checksum = "8ff1f980957787286a554052d03c7aee98d99cc32e09f6d45f0a814133c87978"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"lazy_static", "once_cell",
] ]
[[package]] [[package]]
@ -910,9 +916,9 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -921,11 +927,11 @@ version = "0.99.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
dependencies = [ dependencies = [
"convert_case", "convert_case 0.4.0",
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"rustc_version 0.4.0", "rustc_version 0.4.0",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -1082,9 +1088,9 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -1124,7 +1130,7 @@ dependencies = [
[[package]] [[package]]
name = "filter-parser" name = "filter-parser"
version = "0.29.3" version = "0.29.3"
source = "git+https://github.com/meilisearch/milli.git?tag=v0.29.3#f1d848bb9add86b9414d110a083dfa0462d5d636" source = "git+https://github.com/meilisearch/milli?branch=jayson-integration#6c8d2a5c2f368c67bacf849f6e47134d9347508a"
dependencies = [ dependencies = [
"nom", "nom",
"nom_locate", "nom_locate",
@ -1149,7 +1155,7 @@ dependencies = [
[[package]] [[package]]
name = "flatten-serde-json" name = "flatten-serde-json"
version = "0.29.3" version = "0.29.3"
source = "git+https://github.com/meilisearch/milli.git?tag=v0.29.3#f1d848bb9add86b9414d110a083dfa0462d5d636" source = "git+https://github.com/meilisearch/milli?branch=jayson-integration#6c8d2a5c2f368c67bacf849f6e47134d9347508a"
dependencies = [ dependencies = [
"serde_json", "serde_json",
] ]
@ -1251,9 +1257,9 @@ version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -1313,13 +1319,13 @@ checksum = "9e006f616a407d396ace1d2ebb3f43ed73189db8b098079bd129928d7645dd1e"
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.6" version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
"wasi 0.10.2+wasi-snapshot-preview1", "wasi 0.11.0+wasi-snapshot-preview1",
] ]
[[package]] [[package]]
@ -1329,9 +1335,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9" checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9"
dependencies = [ dependencies = [
"proc-macro-error", "proc-macro-error",
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -1415,10 +1421,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]] [[package]]
name = "heapless" name = "hashbrown"
version = "0.7.13" version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a08e755adbc0ad283725b29f4a4883deee15336f372d5f61fae59efec40f983" checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3"
[[package]]
name = "heapless"
version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "065681e99f9ef7e0e813702a0326aedbcbbde7db5e55f097aedd1bf50b9dca43"
dependencies = [ dependencies = [
"atomic-polyfill", "atomic-polyfill",
"hash32", "hash32",
@ -1581,12 +1593,12 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.8.2" version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown 0.11.2", "hashbrown 0.12.1",
"serde", "serde",
] ]
@ -1626,6 +1638,26 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d"
[[package]]
name = "jayson"
version = "0.1.0"
source = "git+https://github.com/meilisearch/jayson?branch=main#5088e9744eae5125a0da870a34f4fb6365963c07"
dependencies = [
"jayson-internal",
"serde_json",
]
[[package]]
name = "jayson-internal"
version = "0.1.0"
source = "git+https://github.com/meilisearch/jayson?branch=main#5088e9744eae5125a0da870a34f4fb6365963c07"
dependencies = [
"convert_case 0.5.0",
"proc-macro2 1.0.40",
"quote 1.0.20",
"syn 1.0.98",
]
[[package]] [[package]]
name = "jieba-rs" name = "jieba-rs"
version = "0.6.6" version = "0.6.6"
@ -1652,9 +1684,9 @@ dependencies = [
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.57" version = "0.3.58"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
@ -1662,16 +1694,16 @@ dependencies = [
[[package]] [[package]]
name = "json-depth-checker" name = "json-depth-checker"
version = "0.29.3" version = "0.29.3"
source = "git+https://github.com/meilisearch/milli.git?tag=v0.29.3#f1d848bb9add86b9414d110a083dfa0462d5d636" source = "git+https://github.com/meilisearch/milli?branch=jayson-integration#6c8d2a5c2f368c67bacf849f6e47134d9347508a"
dependencies = [ dependencies = [
"serde_json", "serde_json",
] ]
[[package]] [[package]]
name = "jsonwebtoken" name = "jsonwebtoken"
version = "8.1.0" version = "8.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc9051c17f81bae79440afa041b3a278e1de71bfb96d32454b477fd4703ccb6f" checksum = "1aa4b4af834c6cfd35d8763d359661b90f2e45d8f750a0849156c7f4671af09c"
dependencies = [ dependencies = [
"base64", "base64",
"pem", "pem",
@ -1960,9 +1992,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a9062912d7952c5588cc474795e0b9ee008e7e6781127945b85413d4b99d81" checksum = "10a9062912d7952c5588cc474795e0b9ee008e7e6781127945b85413d4b99d81"
dependencies = [ dependencies = [
"log", "log",
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -1982,9 +2014,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f08150cf2bab1fc47c2196f4f41173a27fcd0f684165e5458c0046b53a472e2f" checksum = "f08150cf2bab1fc47c2196f4f41173a27fcd0f684165e5458c0046b53a472e2f"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -2013,7 +2045,7 @@ dependencies = [
"serde_json", "serde_json",
"sha2", "sha2",
"thiserror", "thiserror",
"time 0.3.9", "time 0.3.11",
"uuid", "uuid",
] ]
@ -2045,6 +2077,7 @@ dependencies = [
"http", "http",
"indexmap", "indexmap",
"itertools", "itertools",
"jayson",
"jsonwebtoken", "jsonwebtoken",
"log", "log",
"manifest-dir-macros", "manifest-dir-macros",
@ -2052,6 +2085,7 @@ dependencies = [
"meilisearch-auth", "meilisearch-auth",
"meilisearch-lib", "meilisearch-lib",
"meilisearch-types", "meilisearch-types",
"milli",
"mime", "mime",
"num_cpus", "num_cpus",
"obkv", "obkv",
@ -2064,7 +2098,7 @@ dependencies = [
"regex", "regex",
"reqwest", "reqwest",
"rustls", "rustls",
"rustls-pemfile", "rustls-pemfile 0.3.0",
"segment", "segment",
"serde", "serde",
"serde-cs", "serde-cs",
@ -2080,7 +2114,7 @@ dependencies = [
"tempfile", "tempfile",
"thiserror", "thiserror",
"tikv-jemallocator", "tikv-jemallocator",
"time 0.3.9", "time 0.3.11",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"urlencoding", "urlencoding",
@ -2115,6 +2149,7 @@ dependencies = [
"http", "http",
"indexmap", "indexmap",
"itertools", "itertools",
"jayson",
"lazy_static", "lazy_static",
"log", "log",
"meilisearch-auth", "meilisearch-auth",
@ -2145,7 +2180,7 @@ dependencies = [
"tar", "tar",
"tempfile", "tempfile",
"thiserror", "thiserror",
"time 0.3.9", "time 0.3.11",
"tokio", "tokio",
"uuid", "uuid",
"walkdir", "walkdir",
@ -2157,6 +2192,8 @@ name = "meilisearch-types"
version = "0.28.0" version = "0.28.0"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"jayson",
"milli",
"proptest", "proptest",
"proptest-derive", "proptest-derive",
"serde", "serde",
@ -2190,7 +2227,7 @@ dependencies = [
[[package]] [[package]]
name = "milli" name = "milli"
version = "0.29.3" version = "0.29.3"
source = "git+https://github.com/meilisearch/milli.git?tag=v0.29.3#f1d848bb9add86b9414d110a083dfa0462d5d636" source = "git+https://github.com/meilisearch/milli?branch=jayson-integration#6c8d2a5c2f368c67bacf849f6e47134d9347508a"
dependencies = [ dependencies = [
"bimap", "bimap",
"bincode", "bincode",
@ -2209,6 +2246,7 @@ dependencies = [
"grenad", "grenad",
"heed", "heed",
"itertools", "itertools",
"jayson",
"json-depth-checker", "json-depth-checker",
"levenshtein_automata", "levenshtein_automata",
"log", "log",
@ -2228,7 +2266,7 @@ dependencies = [
"smartstring", "smartstring",
"tempfile", "tempfile",
"thiserror", "thiserror",
"time 0.3.9", "time 0.3.11",
"uuid", "uuid",
] ]
@ -2265,9 +2303,9 @@ dependencies = [
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.8.3" version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
@ -2297,9 +2335,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "262d56735932ee0240d515656e5a7667af3af2a5b0af4da558c4cff2b2aeb0c7" checksum = "262d56735932ee0240d515656e5a7667af3af2a5b0af4da558c4cff2b2aeb0c7"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -2629,9 +2667,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [ dependencies = [
"proc-macro-error-attr", "proc-macro-error-attr",
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
"version_check", "version_check",
] ]
@ -2641,8 +2679,8 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"version_check", "version_check",
] ]
@ -2657,9 +2695,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.39" version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -2718,11 +2756,11 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.18" version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
] ]
[[package]] [[package]]
@ -2784,7 +2822,7 @@ checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"crossbeam-deque", "crossbeam-deque",
"crossbeam-utils 0.8.8", "crossbeam-utils 0.8.9",
"num_cpus", "num_cpus",
] ]
@ -2842,9 +2880,9 @@ dependencies = [
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.11.10" version = "0.11.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92"
dependencies = [ dependencies = [
"base64", "base64",
"bytes", "bytes",
@ -2864,12 +2902,13 @@ dependencies = [
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rustls", "rustls",
"rustls-pemfile", "rustls-pemfile 1.0.0",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"tokio", "tokio",
"tokio-rustls", "tokio-rustls",
"tower-service",
"url", "url",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
@ -2964,7 +3003,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [ dependencies = [
"semver 1.0.9", "semver 1.0.10",
] ]
[[package]] [[package]]
@ -2989,10 +3028,19 @@ dependencies = [
] ]
[[package]] [[package]]
name = "rustversion" name = "rustls-pemfile"
version = "1.0.6" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" checksum = "e7522c9de787ff061458fe9a829dc790a3f5b22dc571694fc5883f448b94d9a9"
dependencies = [
"base64",
]
[[package]]
name = "rustversion"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf"
[[package]] [[package]]
name = "rusty-fork" name = "rusty-fork"
@ -3048,7 +3096,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"thiserror", "thiserror",
"time 0.3.9", "time 0.3.11",
] ]
[[package]] [[package]]
@ -3062,9 +3110,9 @@ dependencies = [
[[package]] [[package]]
name = "semver" name = "semver"
version = "1.0.9" version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd" checksum = "a41d061efea015927ac527063765e73601444cdc344ba855bc7bd44578b25e1c"
[[package]] [[package]]
name = "semver-parser" name = "semver-parser"
@ -3096,9 +3144,9 @@ version = "1.0.137"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -3146,6 +3194,17 @@ dependencies = [
"digest", "digest",
] ]
[[package]]
name = "sha1"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c77f4e7f65455545c2153c1253d25056825e77ee2533f0e41deb65a93a34852f"
dependencies = [
"cfg-if 1.0.0",
"cpufeatures",
"digest",
]
[[package]] [[package]]
name = "sha2" name = "sha2"
version = "0.10.2" version = "0.10.2"
@ -3175,7 +3234,7 @@ dependencies = [
"num-bigint", "num-bigint",
"num-traits", "num-traits",
"thiserror", "thiserror",
"time 0.3.9", "time 0.3.11",
] ]
[[package]] [[package]]
@ -3296,12 +3355,12 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.96" version = "1.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"unicode-ident", "unicode-ident",
] ]
@ -3320,9 +3379,9 @@ version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
"unicode-xid 0.2.3", "unicode-xid 0.2.3",
] ]
@ -3402,9 +3461,9 @@ version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -3430,19 +3489,20 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.43" version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [ dependencies = [
"libc", "libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi", "winapi",
] ]
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.9" version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" checksum = "72c91f41dcb2f096c05f0873d667dceec1087ce5bcf984ec8ffb19acddbb3217"
dependencies = [ dependencies = [
"itoa 1.0.2", "itoa 1.0.2",
"libc", "libc",
@ -3498,9 +3558,9 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
] ]
[[package]] [[package]]
@ -3550,9 +3610,9 @@ dependencies = [
[[package]] [[package]]
name = "tower-service" name = "tower-service"
version = "0.3.1" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
[[package]] [[package]]
name = "tracing" name = "tracing"
@ -3604,9 +3664,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
[[package]] [[package]]
name = "unicode-normalization" name = "unicode-normalization"
@ -3716,7 +3776,7 @@ dependencies = [
"git2", "git2",
"rustversion", "rustversion",
"thiserror", "thiserror",
"time 0.3.9", "time 0.3.11",
] ]
[[package]] [[package]]
@ -3772,9 +3832,9 @@ dependencies = [
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.10.2+wasi-snapshot-preview1" version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]] [[package]]
name = "wasi" name = "wasi"
@ -3784,9 +3844,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.80" version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"wasm-bindgen-macro", "wasm-bindgen-macro",
@ -3794,24 +3854,24 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.80" version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"lazy_static", "lazy_static",
"log", "log",
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.30" version = "0.4.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"js-sys", "js-sys",
@ -3821,38 +3881,38 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.80" version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa"
dependencies = [ dependencies = [
"quote 1.0.18", "quote 1.0.20",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
] ]
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.80" version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"quote 1.0.18", "quote 1.0.20",
"syn 1.0.96", "syn 1.0.98",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.80" version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be"
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.57" version = "0.3.58"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@ -4010,8 +4070,8 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d498dbd1fd7beb83c86709ae1c33ca50942889473473d287d56ce4770a18edfb" checksum = "d498dbd1fd7beb83c86709ae1c33ca50942889473473d287d56ce4770a18edfb"
dependencies = [ dependencies = [
"proc-macro2 1.0.39", "proc-macro2 1.0.40",
"syn 1.0.96", "syn 1.0.98",
"synstructure", "synstructure",
] ]
@ -4026,5 +4086,5 @@ dependencies = [
"crc32fast", "crc32fast",
"flate2", "flate2",
"thiserror", "thiserror",
"time 0.1.43", "time 0.1.44",
] ]

View File

@ -8,7 +8,7 @@ base64 = "0.13.0"
enum-iterator = "0.7.0" enum-iterator = "0.7.0"
hmac = "0.12.1" hmac = "0.12.1"
meilisearch-types = { path = "../meilisearch-types" } meilisearch-types = { path = "../meilisearch-types" }
milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.29.3" } milli = { git = "https://github.com/meilisearch/milli", branch = "jayson-integration" }
rand = "0.8.4" rand = "0.8.4"
serde = { version = "1.0.136", features = ["derive"] } serde = { version = "1.0.136", features = ["derive"] }
serde_json = { version = "1.0.79", features = ["preserve_order"] } serde_json = { version = "1.0.79", features = ["preserve_order"] }

View File

@ -42,11 +42,13 @@ futures-util = "0.3.21"
http = "0.2.6" http = "0.2.6"
indexmap = { version = "1.8.0", features = ["serde-1"] } indexmap = { version = "1.8.0", features = ["serde-1"] }
itertools = "0.10.3" itertools = "0.10.3"
jayson = { git = "https://github.com/meilisearch/jayson", branch = "main" }
jsonwebtoken = "8.0.1" jsonwebtoken = "8.0.1"
log = "0.4.14" log = "0.4.14"
meilisearch-auth = { path = "../meilisearch-auth" } meilisearch-auth = { path = "../meilisearch-auth" }
meilisearch-types = { path = "../meilisearch-types" } meilisearch-types = { path = "../meilisearch-types" }
meilisearch-lib = { path = "../meilisearch-lib" } meilisearch-lib = { path = "../meilisearch-lib" }
milli = { git = "https://github.com/meilisearch/milli", branch = "jayson-integration" }
mime = "0.3.16" mime = "0.3.16"
num_cpus = "1.13.1" num_cpus = "1.13.1"
obkv = "0.2.0" obkv = "0.2.0"

View File

@ -0,0 +1,77 @@
use actix_web::{dev::Payload, web::Json, FromRequest, HttpRequest};
use futures::ready;
use jayson::{DeserializeError, DeserializeFromValue};
use meilisearch_types::error::{ErrorCode, ResponseError};
use std::{
fmt::Debug,
future::Future,
marker::PhantomData,
pin::Pin,
task::{Context, Poll},
};
/// Extractor for typed data from Json request payloads
/// deserialised by Jayson.
///
/// # Extractor
/// To extract typed data from a request body, the inner type `T` must implement the
/// [`jayson::DeserializeFromError<E>`] trait. The inner type `E` must implement the
/// [`ErrorCode`](meilisearch_error::ErrorCode) trait.
#[derive(Debug)]
pub struct ValidatedJson<T, E>(pub T, PhantomData<*const E>);
impl<T, E> ValidatedJson<T, E> {
pub fn new(data: T) -> Self {
ValidatedJson(data, PhantomData)
}
pub fn into_inner(self) -> T {
self.0
}
}
impl<T, E> FromRequest for ValidatedJson<T, E>
where
E: DeserializeError + ErrorCode + 'static,
T: DeserializeFromValue<E>,
{
type Error = actix_web::Error;
type Future = ValidatedJsonExtractFut<T, E>;
#[inline]
fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future {
ValidatedJsonExtractFut {
fut: Json::<serde_json::Value>::from_request(req, payload),
_phantom: PhantomData,
}
}
}
pub struct ValidatedJsonExtractFut<T, E> {
fut: <Json<serde_json::Value> as FromRequest>::Future,
_phantom: PhantomData<*const (T, E)>,
}
impl<T, E> Future for ValidatedJsonExtractFut<T, E>
where
T: DeserializeFromValue<E>,
E: DeserializeError + ErrorCode + 'static,
{
type Output = Result<ValidatedJson<T, E>, actix_web::Error>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let ValidatedJsonExtractFut { fut, .. } = self.get_mut();
let fut = Pin::new(fut);
let res = ready!(fut.poll(cx));
let res = match res {
Err(err) => Err(err),
Ok(data) => match jayson::deserialize::<_, _, E>(data.into_inner()) {
Ok(data) => Ok(ValidatedJson::new(data)),
Err(e) => Err(ResponseError::from(e).into()),
},
};
Poll::Ready(res)
}
}

View File

@ -1,4 +1,5 @@
pub mod payload; pub mod payload;
#[macro_use] #[macro_use]
pub mod authentication; pub mod authentication;
pub mod jayson;
pub mod sequential_extractor; pub mod sequential_extractor;

View File

@ -84,17 +84,19 @@ pub fn configure_data(
web::JsonConfig::default() web::JsonConfig::default()
.content_type(|mime| mime == mime::APPLICATION_JSON) .content_type(|mime| mime == mime::APPLICATION_JSON)
.error_handler(|err, req: &HttpRequest| match err { .error_handler(|err, req: &HttpRequest| match err {
JsonPayloadError::ContentType => match req.headers().get(CONTENT_TYPE) { JsonPayloadError::ContentType => {
Some(content_type) => MeilisearchHttpError::InvalidContentType( match req.headers().get(CONTENT_TYPE) {
content_type.to_str().unwrap_or("unknown").to_string(), Some(content_type) => MeilisearchHttpError::InvalidContentType(
vec![mime::APPLICATION_JSON.to_string()], content_type.to_str().unwrap_or("unknown").to_string(),
) vec![mime::APPLICATION_JSON.to_string()],
.into(), )
None => MeilisearchHttpError::MissingContentType(vec![ .into(),
mime::APPLICATION_JSON.to_string(), None => MeilisearchHttpError::MissingContentType(vec![
]) mime::APPLICATION_JSON.to_string(),
.into(), ])
}, .into(),
}
}
err => PayloadError::from(err).into(), err => PayloadError::from(err).into(),
}), }),
) )

View File

@ -1,15 +1,15 @@
use log::debug; use log::debug;
use actix_web::{web, HttpRequest, HttpResponse};
use meilisearch_lib::index::{Settings, Unchecked};
use meilisearch_lib::index_controller::Update;
use meilisearch_lib::MeiliSearch;
use meilisearch_types::error::ResponseError;
use serde_json::json;
use crate::analytics::Analytics; use crate::analytics::Analytics;
use crate::extractors::authentication::{policies::*, GuardedData}; use crate::extractors::authentication::{policies::*, GuardedData};
use crate::extractors::jayson::ValidatedJson;
use crate::task::SummarizedTaskView; use crate::task::SummarizedTaskView;
use actix_web::{web, HttpRequest, HttpResponse};
use meilisearch_lib::index::Settings;
use meilisearch_lib::index_controller::Update;
use meilisearch_lib::MeiliSearch;
use meilisearch_types::error::{MeiliDeserError, ResponseError};
use serde_json::json;
#[macro_export] #[macro_export]
macro_rules! make_setting_route { macro_rules! make_setting_route {
@ -54,7 +54,10 @@ macro_rules! make_setting_route {
pub async fn update( pub async fn update(
meilisearch: GuardedData<ActionPolicy<{ actions::SETTINGS_UPDATE }>, MeiliSearch>, meilisearch: GuardedData<ActionPolicy<{ actions::SETTINGS_UPDATE }>, MeiliSearch>,
index_uid: actix_web::web::Path<String>, index_uid: actix_web::web::Path<String>,
body: actix_web::web::Json<Option<$type>>, body: crate::extractors::jayson::ValidatedJson<
Option<$type>,
meilisearch_types::error::MeiliDeserError,
>,
req: HttpRequest, req: HttpRequest,
$analytics_var: web::Data<dyn Analytics>, $analytics_var: web::Data<dyn Analytics>,
) -> std::result::Result<HttpResponse, ResponseError> { ) -> std::result::Result<HttpResponse, ResponseError> {
@ -263,18 +266,18 @@ make_setting_route!(
make_setting_route!( make_setting_route!(
"/ranking-rules", "/ranking-rules",
put, put,
Vec<String>, Vec<milli::Criterion>,
ranking_rules, ranking_rules,
"rankingRules", "rankingRules",
analytics, analytics,
|setting: &Option<Vec<String>>, req: &HttpRequest| { |setting: &Option<Vec<milli::Criterion>>, req: &HttpRequest| {
use serde_json::json; use serde_json::json;
analytics.publish( analytics.publish(
"RankingRules Updated".to_string(), "RankingRules Updated".to_string(),
json!({ json!({
"ranking_rules": { "ranking_rules": {
"sort_position": setting.as_ref().map(|sort| sort.iter().position(|s| s == "sort")), "sort_position": setting.as_ref().map(|sort| sort.iter().position(|s| matches!(s, milli::Criterion::Sort))),
} }
}), }),
Some(req), Some(req),
@ -355,7 +358,7 @@ generate_configure!(
pub async fn update_all( pub async fn update_all(
meilisearch: GuardedData<ActionPolicy<{ actions::SETTINGS_UPDATE }>, MeiliSearch>, meilisearch: GuardedData<ActionPolicy<{ actions::SETTINGS_UPDATE }>, MeiliSearch>,
index_uid: web::Path<String>, index_uid: web::Path<String>,
body: web::Json<Settings<Unchecked>>, body: ValidatedJson<Settings, MeiliDeserError>,
req: HttpRequest, req: HttpRequest,
analytics: web::Data<dyn Analytics>, analytics: web::Data<dyn Analytics>,
) -> Result<HttpResponse, ResponseError> { ) -> Result<HttpResponse, ResponseError> {
@ -365,7 +368,7 @@ pub async fn update_all(
"Settings Updated".to_string(), "Settings Updated".to_string(),
json!({ json!({
"ranking_rules": { "ranking_rules": {
"sort_position": settings.ranking_rules.as_ref().set().map(|sort| sort.iter().position(|s| s == "sort")), "sort_position": settings.ranking_rules.as_ref().set().map(|sort| sort.iter().position(|s| matches!(s, milli::Criterion::Sort))),
}, },
"searchable_attributes": { "searchable_attributes": {
"total": settings.searchable_attributes.as_ref().set().map(|searchable| searchable.len()), "total": settings.searchable_attributes.as_ref().set().map(|searchable| searchable.len()),
@ -441,7 +444,7 @@ pub async fn delete_all(
data: GuardedData<ActionPolicy<{ actions::SETTINGS_UPDATE }>, MeiliSearch>, data: GuardedData<ActionPolicy<{ actions::SETTINGS_UPDATE }>, MeiliSearch>,
index_uid: web::Path<String>, index_uid: web::Path<String>,
) -> Result<HttpResponse, ResponseError> { ) -> Result<HttpResponse, ResponseError> {
let settings = Settings::cleared().into_unchecked(); let settings = Settings::cleared();
let allow_index_creation = data.filters().allow_index_creation; let allow_index_creation = data.filters().allow_index_creation;
let update = Update::Settings { let update = Update::Settings {

View File

@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
use time::OffsetDateTime; use time::OffsetDateTime;
use meilisearch_lib::index::{Settings, Unchecked}; use meilisearch_lib::index::Settings;
use meilisearch_lib::MeiliSearch; use meilisearch_lib::MeiliSearch;
use meilisearch_types::error::ResponseError; use meilisearch_types::error::ResponseError;
use meilisearch_types::star_or::StarOr; use meilisearch_types::star_or::StarOr;
@ -140,7 +140,7 @@ pub enum UpdateType {
number: Option<usize>, number: Option<usize>,
}, },
Settings { Settings {
settings: Settings<Unchecked>, settings: Settings,
}, },
} }

View File

@ -3,7 +3,7 @@ use std::fmt::{self, Write};
use std::str::FromStr; use std::str::FromStr;
use std::write; use std::write;
use meilisearch_lib::index::{Settings, Unchecked}; use meilisearch_lib::index::Settings;
use meilisearch_lib::tasks::batch::BatchId; use meilisearch_lib::tasks::batch::BatchId;
use meilisearch_lib::tasks::task::{ use meilisearch_lib::tasks::task::{
DocumentDeletion, Task, TaskContent, TaskEvent, TaskId, TaskResult, DocumentDeletion, Task, TaskContent, TaskEvent, TaskId, TaskResult,
@ -144,7 +144,7 @@ enum TaskDetails {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
Settings { Settings {
#[serde(flatten)] #[serde(flatten)]
settings: Settings<Unchecked>, settings: Settings,
}, },
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
IndexInfo { primary_key: Option<String> }, IndexInfo { primary_key: Option<String> },

View File

@ -291,23 +291,20 @@ async fn error_set_invalid_ranking_rules() {
let index = server.index("test"); let index = server.index("test");
index.create(None).await; index.create(None).await;
let (_response, _code) = index let (response, code) = index
.update_settings(json!({ "rankingRules": [ "manyTheFish"]})) .update_settings(json!({ "rankingRules": [ "manyTheFish"]}))
.await; .await;
index.wait_task(1).await;
let (response, code) = index.get_task(1).await;
assert_eq!(code, 200); assert_eq!(code, 400);
assert_eq!(response["status"], "failed");
let expected_error = json!({ let expected_error = json!({
"message": r#"`manyTheFish` ranking rule is invalid. Valid ranking rules are words, typo, sort, proximity, attribute, exactness and custom ranking rules."#, "code": "malformed_payload",
"code": "invalid_ranking_rule", "link": "https://docs.meilisearch.com/errors#malformed_payload",
"type": "invalid_request", "message": "ValuePointer { path: [Key(\"rankingRules\"), Index(0)] } -> `manyTheFish` ranking rule is invalid. Valid ranking rules are words, typo, sort, proximity, attribute, exactness and custom ranking rules. ",
"link": "https://docs.meilisearch.com/errors#invalid_ranking_rule" "type": "invalid_request"
}); });
assert_eq!(response["error"], expected_error); assert_eq!(response, expected_error);
} }
#[actix_rt::test] #[actix_rt::test]

View File

@ -30,7 +30,8 @@ lazy_static = "1.4.0"
log = "0.4.14" log = "0.4.14"
meilisearch-auth = { path = "../meilisearch-auth" } meilisearch-auth = { path = "../meilisearch-auth" }
meilisearch-types = { path = "../meilisearch-types" } meilisearch-types = { path = "../meilisearch-types" }
milli = { git = "https://github.com/meilisearch/milli.git", tag = "v0.29.3" } milli = { git = "https://github.com/meilisearch/milli", branch = "jayson-integration" }
jayson = { git = "https://github.com/meilisearch/jayson", branch = "main" }
mime = "0.3.16" mime = "0.3.16"
num_cpus = "1.13.1" num_cpus = "1.13.1"
obkv = "0.2.0" obkv = "0.2.0"

View File

@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
use time::OffsetDateTime; use time::OffsetDateTime;
use uuid::Uuid; use uuid::Uuid;
use crate::index::{Settings, Unchecked}; use crate::index::Settings;
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
pub struct UpdateEntry { pub struct UpdateEntry {
@ -43,7 +43,7 @@ pub enum UpdateMeta {
DeleteDocuments { DeleteDocuments {
ids: Vec<String>, ids: Vec<String>,
}, },
Settings(Settings<Unchecked>), Settings(Settings),
} }
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]

View File

@ -6,7 +6,7 @@ use time::OffsetDateTime;
use uuid::Uuid; use uuid::Uuid;
use super::v4::{Task, TaskContent, TaskEvent}; use super::v4::{Task, TaskContent, TaskEvent};
use crate::index::{Settings, Unchecked}; use crate::index::Settings;
use crate::tasks::task::{DocumentDeletion, TaskId, TaskResult}; use crate::tasks::task::{DocumentDeletion, TaskId, TaskResult};
use super::v2; use super::v2;
@ -55,7 +55,7 @@ pub enum Update {
method: IndexDocumentsMethod, method: IndexDocumentsMethod,
content_uuid: Uuid, content_uuid: Uuid,
}, },
Settings(Settings<Unchecked>), Settings(Settings),
ClearDocuments, ClearDocuments,
} }
@ -100,7 +100,7 @@ pub enum UpdateMeta {
DeleteDocuments { DeleteDocuments {
ids: Vec<String>, ids: Vec<String>,
}, },
Settings(Settings<Unchecked>), Settings(Settings),
} }
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]

View File

@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
use time::OffsetDateTime; use time::OffsetDateTime;
use uuid::Uuid; use uuid::Uuid;
use crate::index::{Settings, Unchecked}; use crate::index::Settings;
use crate::tasks::batch::BatchId; use crate::tasks::batch::BatchId;
use crate::tasks::task::{ use crate::tasks::task::{
DocumentDeletion, TaskContent as NewTaskContent, TaskEvent as NewTaskEvent, TaskId, TaskResult, DocumentDeletion, TaskContent as NewTaskContent, TaskEvent as NewTaskEvent, TaskId, TaskResult,
@ -82,7 +82,7 @@ pub enum TaskContent {
}, },
DocumentDeletion(DocumentDeletion), DocumentDeletion(DocumentDeletion),
SettingsUpdate { SettingsUpdate {
settings: Settings<Unchecked>, settings: Settings,
/// Indicates whether the task was a deletion /// Indicates whether the task was a deletion
is_deletion: bool, is_deletion: bool,
allow_index_creation: bool, allow_index_creation: bool,

View File

@ -78,11 +78,17 @@ fn patch_updates(dir: impl AsRef<Path>, path: impl AsRef<Path>) -> anyhow::Resul
let mut output_update_file = NamedTempFile::new_in(&dir)?; let mut output_update_file = NamedTempFile::new_in(&dir)?;
let update_file = File::open(&path)?; let update_file = File::open(&path)?;
let stream = Deserializer::from_reader(update_file).into_iter::<v2::UpdateEntry>(); let updates = Deserializer::from_reader(update_file).into_iter::<serde_json::Value>();
for update_entry in updates {
for update in stream { let mut update_entry = update_entry?;
let update_entry = update?; println!("{:?}", update_entry);
// We first deserialize the dump meta into a serde_json::Value and change
// the custom ranking rules settings from the old format to the new format.
if let Some(ranking_rules) = update_entry.pointer_mut("/update/meta/rankingRules") {
patch_custom_ranking_rules(ranking_rules);
}
let update_entry: v2::UpdateEntry = serde_json::from_value(update_entry)?;
let update_entry = v3::UpdateEntry::from(update_entry); let update_entry = v3::UpdateEntry::from(update_entry);
serde_json::to_writer(&mut output_update_file, &update_entry)?; serde_json::to_writer(&mut output_update_file, &update_entry)?;

View File

@ -13,11 +13,11 @@ use crate::document_formats::read_ndjson;
use crate::index::updates::apply_settings_to_builder; use crate::index::updates::apply_settings_to_builder;
use super::error::Result; use super::error::Result;
use super::{index::Index, Settings, Unchecked}; use super::{index::Index, Settings};
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
struct DumpMeta { struct DumpMeta {
settings: Settings<Unchecked>, settings: Settings,
primary_key: Option<String>, primary_key: Option<String>,
} }
@ -69,7 +69,7 @@ impl Index {
let meta_file_path = path.as_ref().join(META_FILE_NAME); let meta_file_path = path.as_ref().join(META_FILE_NAME);
let mut meta_file = File::create(&meta_file_path)?; let mut meta_file = File::create(&meta_file_path)?;
let settings = self.settings_txn(txn)?.into_unchecked(); let settings = self.settings_txn(txn)?;
let primary_key = self.primary_key(txn)?.map(String::from); let primary_key = self.primary_key(txn)?.map(String::from);
let meta = DumpMeta { let meta = DumpMeta {
settings, settings,
@ -101,7 +101,6 @@ impl Index {
settings, settings,
primary_key, primary_key,
} = serde_json::from_reader(meta_file)?; } = serde_json::from_reader(meta_file)?;
let settings = settings.check();
let mut options = EnvOpenOptions::new(); let mut options = EnvOpenOptions::new();
options.map_size(size); options.map_size(size);

View File

@ -1,6 +1,5 @@
use std::collections::BTreeSet; use std::collections::BTreeSet;
use std::fs::create_dir_all; use std::fs::create_dir_all;
use std::marker::PhantomData;
use std::ops::Deref; use std::ops::Deref;
use std::path::Path; use std::path::Path;
use std::sync::Arc; use std::sync::Arc;
@ -20,7 +19,7 @@ use crate::EnvSizer;
use super::error::IndexError; use super::error::IndexError;
use super::error::Result; use super::error::Result;
use super::updates::{FacetingSettings, MinWordSizeTyposSetting, PaginationSettings, TypoSettings}; use super::updates::{FacetingSettings, MinWordSizeTyposSetting, PaginationSettings, TypoSettings};
use super::{Checked, Settings}; use super::Settings;
pub type Document = Map<String, Value>; pub type Document = Map<String, Value>;
@ -121,7 +120,7 @@ impl Index {
pub fn meta(&self) -> Result<IndexMeta> { pub fn meta(&self) -> Result<IndexMeta> {
IndexMeta::new(self) IndexMeta::new(self)
} }
pub fn settings(&self) -> Result<Settings<Checked>> { pub fn settings(&self) -> Result<Settings> {
let txn = self.read_txn()?; let txn = self.read_txn()?;
self.settings_txn(&txn) self.settings_txn(&txn)
} }
@ -130,7 +129,7 @@ impl Index {
self.uuid self.uuid
} }
pub fn settings_txn(&self, txn: &RoTxn) -> Result<Settings<Checked>> { pub fn settings_txn(&self, txn: &RoTxn) -> Result<Settings> {
let displayed_attributes = self let displayed_attributes = self
.displayed_fields(txn)? .displayed_fields(txn)?
.map(|fields| fields.into_iter().map(String::from).collect()); .map(|fields| fields.into_iter().map(String::from).collect());
@ -143,11 +142,7 @@ impl Index {
let sortable_attributes = self.sortable_fields(txn)?.into_iter().collect(); let sortable_attributes = self.sortable_fields(txn)?.into_iter().collect();
let criteria = self let criteria = self.criteria(txn)?;
.criteria(txn)?
.into_iter()
.map(|c| c.to_string())
.collect();
let stop_words = self let stop_words = self
.stop_words(txn)? .stop_words(txn)?
@ -229,7 +224,6 @@ impl Index {
typo_tolerance: Setting::Set(typo_tolerance), typo_tolerance: Setting::Set(typo_tolerance),
faceting: Setting::Set(faceting), faceting: Setting::Set(faceting),
pagination: Setting::Set(pagination), pagination: Setting::Set(pagination),
_kind: PhantomData,
}) })
} }

View File

@ -2,7 +2,7 @@ pub use search::{
SearchQuery, SearchResult, DEFAULT_CROP_LENGTH, DEFAULT_CROP_MARKER, SearchQuery, SearchResult, DEFAULT_CROP_LENGTH, DEFAULT_CROP_MARKER,
DEFAULT_HIGHLIGHT_POST_TAG, DEFAULT_HIGHLIGHT_PRE_TAG, DEFAULT_SEARCH_LIMIT, DEFAULT_HIGHLIGHT_POST_TAG, DEFAULT_HIGHLIGHT_PRE_TAG, DEFAULT_SEARCH_LIMIT,
}; };
pub use updates::{apply_settings_to_builder, Checked, Facets, Settings, Unchecked}; pub use updates::{apply_settings_to_builder, Facets, Settings};
mod dump; mod dump;
pub mod error; pub mod error;
@ -36,7 +36,7 @@ pub mod test {
use super::error::Result; use super::error::Result;
use super::index::Index; use super::index::Index;
use super::Document; use super::Document;
use super::{Checked, IndexMeta, IndexStats, SearchQuery, SearchResult, Settings}; use super::{IndexMeta, IndexStats, SearchQuery, SearchResult, Settings};
use crate::update_file_store::UpdateFileStore; use crate::update_file_store::UpdateFileStore;
#[derive(Clone)] #[derive(Clone)]
@ -89,7 +89,7 @@ pub mod test {
MockIndex::Mock(_) => todo!(), MockIndex::Mock(_) => todo!(),
} }
} }
pub fn settings(&self) -> Result<Settings<Checked>> { pub fn settings(&self) -> Result<Settings> {
match self { match self {
MockIndex::Real(index) => index.settings(), MockIndex::Real(index) => index.settings(),
MockIndex::Mock(_) => todo!(), MockIndex::Mock(_) => todo!(),
@ -175,7 +175,7 @@ pub mod test {
} }
} }
pub fn update_settings(&self, settings: &Settings<Checked>) -> Result<()> { pub fn update_settings(&self, settings: &Settings) -> Result<()> {
match self { match self {
MockIndex::Real(index) => index.update_settings(settings), MockIndex::Real(index) => index.update_settings(settings),
MockIndex::Mock(m) => unsafe { m.get("update_settings").call(settings) }, MockIndex::Mock(m) => unsafe { m.get("update_settings").call(settings) },

View File

@ -1,14 +1,15 @@
use std::collections::{BTreeMap, BTreeSet}; use jayson::DeserializeFromValue;
use std::marker::PhantomData;
use std::num::NonZeroUsize;
use log::{debug, info, trace}; use log::{debug, info, trace};
use milli::documents::DocumentBatchReader; use milli::documents::DocumentBatchReader;
use milli::update::{ use milli::update::{
DocumentAdditionResult, DocumentDeletionResult, IndexDocumentsConfig, IndexDocumentsMethod, DocumentAdditionResult, DocumentDeletionResult, IndexDocumentsConfig, IndexDocumentsMethod,
Setting, Setting,
}; };
use milli::Criterion;
use serde::{Deserialize, Serialize, Serializer}; use serde::{Deserialize, Serialize, Serializer};
use std::collections::{BTreeMap, BTreeSet};
use std::convert::Infallible;
use std::num::NonZeroUsize;
use uuid::Uuid; use uuid::Uuid;
use super::error::Result; use super::error::Result;
@ -31,14 +32,8 @@ where
.serialize(s) .serialize(s)
} }
#[derive(Clone, Default, Debug, Serialize, PartialEq)]
pub struct Checked;
#[derive(Clone, Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct Unchecked;
#[cfg_attr(test, derive(proptest_derive::Arbitrary))] #[cfg_attr(test, derive(proptest_derive::Arbitrary))]
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, DeserializeFromValue)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MinWordSizeTyposSetting { pub struct MinWordSizeTyposSetting {
@ -51,7 +46,9 @@ pub struct MinWordSizeTyposSetting {
} }
#[cfg_attr(test, derive(proptest_derive::Arbitrary))] #[cfg_attr(test, derive(proptest_derive::Arbitrary))]
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[derive(
Debug, Clone, Default, Serialize, Deserialize, PartialEq, jayson::DeserializeFromValue,
)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct TypoSettings { pub struct TypoSettings {
@ -70,7 +67,8 @@ pub struct TypoSettings {
} }
#[cfg_attr(test, derive(proptest_derive::Arbitrary))] #[cfg_attr(test, derive(proptest_derive::Arbitrary))]
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, DeserializeFromValue)]
#[jayson(rename_all = camelCase, deny_unknown_fields)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct FacetingSettings { pub struct FacetingSettings {
@ -80,7 +78,10 @@ pub struct FacetingSettings {
} }
#[cfg_attr(test, derive(proptest_derive::Arbitrary))] #[cfg_attr(test, derive(proptest_derive::Arbitrary))]
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[derive(
Debug, Clone, Default, Serialize, Deserialize, PartialEq, jayson::DeserializeFromValue,
)]
#[jayson(rename_all = camelCase, deny_unknown_fields)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PaginationSettings { pub struct PaginationSettings {
@ -89,15 +90,16 @@ pub struct PaginationSettings {
pub limited_to: Setting<usize>, pub limited_to: Setting<usize>,
} }
/// Holds all the settings for an index. `T` can either be `Checked` if they represents settings /// Holds all the settings for an index. The settings are validated by the implementation of
/// whose validity is guaranteed, or `Unchecked` if they need to be validated. In the later case, a /// jayson::DeserializeFromValue.
/// call to `check` will return a `Settings<Checked>` from a `Settings<Unchecked>`. #[derive(
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] Debug, Clone, Default, Serialize, Deserialize, PartialEq, jayson::DeserializeFromValue,
)]
#[jayson(rename_all = camelCase, deny_unknown_fields, validate = check_settings -> Infallible)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
#[serde(bound(serialize = "T: Serialize", deserialize = "T: Deserialize<'static>"))]
#[cfg_attr(test, derive(proptest_derive::Arbitrary))] #[cfg_attr(test, derive(proptest_derive::Arbitrary))]
pub struct Settings<T> { pub struct Settings {
#[serde( #[serde(
default, default,
serialize_with = "serialize_with_wildcard", serialize_with = "serialize_with_wildcard",
@ -121,8 +123,9 @@ pub struct Settings<T> {
#[cfg_attr(test, proptest(strategy = "test::setting_strategy()"))] #[cfg_attr(test, proptest(strategy = "test::setting_strategy()"))]
pub sortable_attributes: Setting<BTreeSet<String>>, pub sortable_attributes: Setting<BTreeSet<String>>,
#[serde(default, skip_serializing_if = "Setting::is_not_set")] #[serde(default, skip_serializing_if = "Setting::is_not_set")]
#[cfg_attr(test, proptest(strategy = "test::setting_strategy()"))] #[cfg_attr(test, proptest(strategy = "test::criteria_setting_strategy()"))]
pub ranking_rules: Setting<Vec<String>>, #[jayson(needs_predicate)]
pub ranking_rules: Setting<Vec<Criterion>>,
#[serde(default, skip_serializing_if = "Setting::is_not_set")] #[serde(default, skip_serializing_if = "Setting::is_not_set")]
#[cfg_attr(test, proptest(strategy = "test::setting_strategy()"))] #[cfg_attr(test, proptest(strategy = "test::setting_strategy()"))]
pub stop_words: Setting<BTreeSet<String>>, pub stop_words: Setting<BTreeSet<String>>,
@ -141,13 +144,10 @@ pub struct Settings<T> {
#[serde(default, skip_serializing_if = "Setting::is_not_set")] #[serde(default, skip_serializing_if = "Setting::is_not_set")]
#[cfg_attr(test, proptest(strategy = "test::setting_strategy()"))] #[cfg_attr(test, proptest(strategy = "test::setting_strategy()"))]
pub pagination: Setting<PaginationSettings>, pub pagination: Setting<PaginationSettings>,
#[serde(skip)]
pub _kind: PhantomData<T>,
} }
impl Settings<Checked> { impl Settings {
pub fn cleared() -> Settings<Checked> { pub fn cleared() -> Settings {
Settings { Settings {
displayed_attributes: Setting::Reset, displayed_attributes: Setting::Reset,
searchable_attributes: Setting::Reset, searchable_attributes: Setting::Reset,
@ -160,82 +160,59 @@ impl Settings<Checked> {
typo_tolerance: Setting::Reset, typo_tolerance: Setting::Reset,
faceting: Setting::Reset, faceting: Setting::Reset,
pagination: Setting::Reset, pagination: Setting::Reset,
_kind: PhantomData,
}
}
pub fn into_unchecked(self) -> Settings<Unchecked> {
let Self {
displayed_attributes,
searchable_attributes,
filterable_attributes,
sortable_attributes,
ranking_rules,
stop_words,
synonyms,
distinct_attribute,
typo_tolerance,
faceting,
pagination,
..
} = self;
Settings {
displayed_attributes,
searchable_attributes,
filterable_attributes,
sortable_attributes,
ranking_rules,
stop_words,
synonyms,
distinct_attribute,
typo_tolerance,
faceting,
pagination,
_kind: PhantomData,
} }
} }
} }
fn check_settings(settings: Settings) -> std::result::Result<Settings, Infallible> {
let Settings {
displayed_attributes,
searchable_attributes,
filterable_attributes,
sortable_attributes,
ranking_rules,
stop_words,
synonyms,
distinct_attribute,
typo_tolerance,
faceting,
pagination,
} = settings;
impl Settings<Unchecked> { let displayed_attributes = match displayed_attributes {
pub fn check(self) -> Settings<Checked> { Setting::Set(fields) => {
let displayed_attributes = match self.displayed_attributes { if fields.iter().any(|f| f == "*") {
Setting::Set(fields) => { Setting::Reset
if fields.iter().any(|f| f == "*") { } else {
Setting::Reset Setting::Set(fields)
} else {
Setting::Set(fields)
}
} }
otherwise => otherwise,
};
let searchable_attributes = match self.searchable_attributes {
Setting::Set(fields) => {
if fields.iter().any(|f| f == "*") {
Setting::Reset
} else {
Setting::Set(fields)
}
}
otherwise => otherwise,
};
Settings {
displayed_attributes,
searchable_attributes,
filterable_attributes: self.filterable_attributes,
sortable_attributes: self.sortable_attributes,
ranking_rules: self.ranking_rules,
stop_words: self.stop_words,
synonyms: self.synonyms,
distinct_attribute: self.distinct_attribute,
typo_tolerance: self.typo_tolerance,
faceting: self.faceting,
pagination: self.pagination,
_kind: PhantomData,
} }
} otherwise => otherwise,
};
let searchable_attributes = match searchable_attributes {
Setting::Set(fields) => {
if fields.iter().any(|f| f == "*") {
Setting::Reset
} else {
Setting::Set(fields)
}
}
otherwise => otherwise,
};
Ok(Settings {
displayed_attributes,
searchable_attributes,
filterable_attributes,
sortable_attributes,
ranking_rules,
stop_words,
synonyms,
distinct_attribute,
typo_tolerance,
faceting,
pagination,
})
} }
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -338,7 +315,7 @@ impl Index {
Ok(addition) Ok(addition)
} }
pub fn update_settings(&self, settings: &Settings<Checked>) -> Result<()> { pub fn update_settings(&self, settings: &Settings) -> Result<()> {
// We must use the write transaction of the update here. // We must use the write transaction of the update here.
let mut txn = self.write_txn()?; let mut txn = self.write_txn()?;
let mut builder = let mut builder =
@ -354,10 +331,7 @@ impl Index {
} }
} }
pub fn apply_settings_to_builder( pub fn apply_settings_to_builder(settings: &Settings, builder: &mut milli::update::Settings) {
settings: &Settings<Checked>,
builder: &mut milli::update::Settings,
) {
match settings.searchable_attributes { match settings.searchable_attributes {
Setting::Set(ref names) => builder.set_searchable_fields(names.clone()), Setting::Set(ref names) => builder.set_searchable_fields(names.clone()),
Setting::Reset => builder.reset_searchable_fields(), Setting::Reset => builder.reset_searchable_fields(),
@ -486,10 +460,35 @@ pub fn apply_settings_to_builder(
#[cfg(test)] #[cfg(test)]
pub(crate) mod test { pub(crate) mod test {
use proptest::prelude::*;
use super::*; use super::*;
use meilisearch_types::error::MeiliDeserError;
use milli::Criterion;
use proptest::prelude::*;
use serde_json::json;
fn criteria_strategy() -> impl Strategy<Value = Vec<Criterion>> {
proptest::collection::vec(
prop_oneof![
Just(Criterion::Words),
Just(Criterion::Typo),
Just(Criterion::Proximity),
Just(Criterion::Attribute),
Just(Criterion::Sort),
Just(Criterion::Exactness),
any::<String>().prop_map(Criterion::Asc),
any::<String>().prop_map(Criterion::Desc),
],
0..100,
)
}
pub(super) fn criteria_setting_strategy() -> impl Strategy<Value = Setting<Vec<Criterion>>> {
prop_oneof![
Just(Setting::NotSet),
Just(Setting::Reset),
criteria_strategy().prop_map(Setting::Set),
]
}
pub(super) fn setting_strategy<T: Arbitrary + Clone>() -> impl Strategy<Value = Setting<T>> { pub(super) fn setting_strategy<T: Arbitrary + Clone>() -> impl Strategy<Value = Setting<T>> {
prop_oneof![ prop_oneof![
Just(Setting::NotSet), Just(Setting::NotSet),
@ -500,48 +499,30 @@ pub(crate) mod test {
#[test] #[test]
fn test_setting_check() { fn test_setting_check() {
// test no changes let j = json!({
let settings = Settings { "filterableAttributes": ["a", "b"],
displayed_attributes: Setting::Set(vec![String::from("hello")]), "searchableAttributes": ["*", "b"],
searchable_attributes: Setting::Set(vec![String::from("hello")]), });
filterable_attributes: Setting::NotSet, let settings: Settings = jayson::deserialize::<_, _, MeiliDeserError>(j).unwrap();
sortable_attributes: Setting::NotSet,
ranking_rules: Setting::NotSet,
stop_words: Setting::NotSet,
synonyms: Setting::NotSet,
distinct_attribute: Setting::NotSet,
typo_tolerance: Setting::NotSet,
faceting: Setting::NotSet,
pagination: Setting::NotSet,
_kind: PhantomData::<Unchecked>,
};
let checked = settings.clone().check();
assert_eq!(settings.displayed_attributes, checked.displayed_attributes);
assert_eq!( assert_eq!(
settings.searchable_attributes, settings.filterable_attributes,
checked.searchable_attributes Setting::Set([String::from("a"), String::from("b")].into_iter().collect())
); );
assert_eq!(settings.searchable_attributes, Setting::Reset);
// test wildcard let j = json!({
// test no changes "displayedAttributes": ["c", "*"],
let settings = Settings { });
displayed_attributes: Setting::Set(vec![String::from("*")]), let settings: Settings = jayson::deserialize::<_, _, MeiliDeserError>(j).unwrap();
searchable_attributes: Setting::Set(vec![String::from("hello"), String::from("*")]), assert_eq!(settings.displayed_attributes, Setting::Reset);
filterable_attributes: Setting::NotSet,
sortable_attributes: Setting::NotSet,
ranking_rules: Setting::NotSet,
stop_words: Setting::NotSet,
synonyms: Setting::NotSet,
distinct_attribute: Setting::NotSet,
typo_tolerance: Setting::NotSet,
faceting: Setting::NotSet,
pagination: Setting::NotSet,
_kind: PhantomData::<Unchecked>,
};
let checked = settings.check(); let j = json!({
assert_eq!(checked.displayed_attributes, Setting::Reset); "filterableAttributes": ["*"],
assert_eq!(checked.searchable_attributes, Setting::Reset); });
let settings: Settings = jayson::deserialize::<_, _, MeiliDeserError>(j).unwrap();
assert_eq!(
settings.filterable_attributes,
Setting::Set([String::from("*")].into_iter().collect())
);
} }
} }

View File

@ -22,9 +22,7 @@ use uuid::Uuid;
use crate::document_formats::{read_csv, read_json, read_ndjson}; use crate::document_formats::{read_csv, read_json, read_ndjson};
use crate::dump::{self, load_dump, DumpHandler}; use crate::dump::{self, load_dump, DumpHandler};
use crate::index::{ use crate::index::{Document, IndexMeta, IndexStats, SearchQuery, SearchResult, Settings};
Checked, Document, IndexMeta, IndexStats, SearchQuery, SearchResult, Settings, Unchecked,
};
use crate::index_resolver::error::IndexResolverError; use crate::index_resolver::error::IndexResolverError;
use crate::options::{IndexerOpts, SchedulerConfig}; use crate::options::{IndexerOpts, SchedulerConfig};
use crate::snapshot::{load_snapshot, SnapshotService}; use crate::snapshot::{load_snapshot, SnapshotService};
@ -126,7 +124,7 @@ pub enum Update {
DeleteDocuments(Vec<String>), DeleteDocuments(Vec<String>),
ClearDocuments, ClearDocuments,
Settings { Settings {
settings: Settings<Unchecked>, settings: Settings,
/// Indicates whether the update was a deletion /// Indicates whether the update was a deletion
is_deletion: bool, is_deletion: bool,
allow_index_creation: bool, allow_index_creation: bool,
@ -530,7 +528,7 @@ where
Ok(ret) Ok(ret)
} }
pub async fn settings(&self, uid: String) -> Result<Settings<Checked>> { pub async fn settings(&self, uid: String) -> Result<Settings> {
let index = self.index_resolver.get_index(uid).await?; let index = self.index_resolver.get_index(uid).await?;
let settings = spawn_blocking(move || index.settings()).await??; let settings = spawn_blocking(move || index.settings()).await??;
Ok(settings) Ok(settings)

View File

@ -225,7 +225,7 @@ mod real {
}; };
let settings = settings.clone(); let settings = settings.clone();
spawn_blocking(move || index.update_settings(&settings.check())).await??; spawn_blocking(move || index.update_settings(&settings)).await??;
Ok(TaskResult::Other) Ok(TaskResult::Other)
} }

View File

@ -6,7 +6,7 @@ use time::OffsetDateTime;
use uuid::Uuid; use uuid::Uuid;
use super::batch::BatchId; use super::batch::BatchId;
use crate::index::{Settings, Unchecked}; use crate::index::Settings;
pub type TaskId = u32; pub type TaskId = u32;
@ -155,7 +155,7 @@ pub enum TaskContent {
}, },
SettingsUpdate { SettingsUpdate {
index_uid: IndexUid, index_uid: IndexUid,
settings: Settings<Unchecked>, settings: Settings,
/// Indicates whether the task was a deletion /// Indicates whether the task was a deletion
is_deletion: bool, is_deletion: bool,
allow_index_creation: bool, allow_index_creation: bool,

View File

@ -10,6 +10,8 @@ proptest = { version = "1.0.0", optional = true }
proptest-derive = { version = "0.3.0", optional = true } proptest-derive = { version = "0.3.0", optional = true }
serde = { version = "1.0.136", features = ["derive"] } serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.79" serde_json = "1.0.79"
jayson = { git = "https://github.com/meilisearch/jayson", branch = "main" }
milli = { git = "https://github.com/meilisearch/milli", branch = "jayson-integration" }
[features] [features]
test-traits = ["proptest", "proptest-derive"] test-traits = ["proptest", "proptest-derive"]

View File

@ -1,6 +1,7 @@
use std::fmt; use std::{convert::Infallible, fmt};
use actix_web::{self as aweb, http::StatusCode, HttpResponseBuilder}; use actix_web::{self as aweb, http::StatusCode, HttpResponseBuilder};
use jayson::{ValueKind, ValuePointerRef};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
@ -22,6 +23,97 @@ pub struct ResponseError {
error_link: String, error_link: String,
} }
#[derive(Debug)]
pub struct MeiliDeserError(String);
impl std::fmt::Display for MeiliDeserError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
impl std::error::Error for MeiliDeserError {}
impl ErrorCode for MeiliDeserError {
fn error_code(&self) -> Code {
Code::MalformedPayload
}
}
impl jayson::MergeWithError<Infallible> for MeiliDeserError {
fn merge(
_self_: Option<Self>,
_other: Infallible,
_merge_location: jayson::ValuePointerRef,
) -> Result<Self, Self> {
unreachable!()
}
}
impl jayson::MergeWithError<milli::CriterionError> for MeiliDeserError {
fn merge(
_self_: Option<Self>,
other: milli::CriterionError,
merge_location: jayson::ValuePointerRef,
) -> Result<Self, Self> {
let pointer = merge_location.to_owned();
Err(MeiliDeserError(format!("{pointer:?} -> {other} ")))
}
}
impl jayson::MergeWithError<MeiliDeserError> for MeiliDeserError {
fn merge(
_self_: Option<Self>,
other: MeiliDeserError,
_merge_location: ValuePointerRef,
) -> Result<Self, Self> {
Err(other)
}
}
impl jayson::DeserializeError for MeiliDeserError {
/// Return the origin of the error, if it can be found
fn location(&self) -> Option<jayson::ValuePointer> {
None
}
/// Create a new error due to an unexpected value kind.
///
/// Return `Ok` to continue deserializing or `Err` to fail early.
fn incorrect_value_kind(
_self_: Option<Self>,
actual: ValueKind,
_accepted: &[ValueKind],
_location: ValuePointerRef,
) -> Result<Self, Self> {
Err(MeiliDeserError(format!("incorrect value kind {actual}")))
}
/// Create a new error due to a missing key.
///
/// Return `Ok` to continue deserializing or `Err` to fail early.
fn missing_field(
_self_: Option<Self>,
field: &str,
_location: ValuePointerRef,
) -> Result<Self, Self> {
Err(MeiliDeserError(format!("missing field {field}")))
}
/// Create a new error due to finding an unknown key.
///
/// Return `Ok` to continue deserializing or `Err` to fail early.
fn unknown_key(
_self_: Option<Self>,
key: &str,
_accepted: &[&str],
_location: ValuePointerRef,
) -> Result<Self, Self> {
Err(MeiliDeserError(format!("unknown key {key}")))
}
/// Create a new error with the custom message.
///
/// Return `Ok` to continue deserializing or `Err` to fail early.
fn unexpected(
_self_: Option<Self>,
msg: &str,
_location: ValuePointerRef,
) -> Result<Self, Self> {
Err(MeiliDeserError(format!("unexpected {msg}")))
}
}
impl ResponseError { impl ResponseError {
pub fn from_msg(message: String, code: Code) -> Self { pub fn from_msg(message: String, code: Code) -> Self {
Self { Self {