620: Fix word criterion r=Kerollmops a=ManyTheFish

related to https://github.com/meilisearch/meilisearch/issues/2722

- fix the word strategy bug
- update milli version to v0.33.2

Co-authored-by: ManyTheFish <many@meilisearch.com>
This commit is contained in:
bors[bot] 2022-09-01 10:14:35 +00:00 committed by GitHub
commit f7c352a32d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 32 additions and 12 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "benchmarks"
version = "0.33.1"
version = "0.33.2"
edition = "2018"
publish = false

View File

@ -1,6 +1,6 @@
[package]
name = "cli"
version = "0.33.1"
version = "0.33.2"
edition = "2018"
description = "A CLI to interact with a milli index"
publish = false

View File

@ -1,6 +1,6 @@
[package]
name = "filter-parser"
version = "0.33.1"
version = "0.33.2"
edition = "2021"
description = "The parser for the Meilisearch filter syntax"
publish = false

View File

@ -1,6 +1,6 @@
[package]
name = "flatten-serde-json"
version = "0.33.1"
version = "0.33.2"
edition = "2021"
description = "Flatten serde-json objects like elastic search"
readme = "README.md"

View File

@ -1,6 +1,6 @@
[package]
name = "helpers"
version = "0.33.1"
version = "0.33.2"
authors = ["Clément Renault <clement@meilisearch.com>"]
edition = "2018"
description = "A small tool to do operations on the database"

View File

@ -1,7 +1,7 @@
[package]
name = "http-ui"
description = "The HTTP user interface of the milli search engine"
version = "0.33.1"
version = "0.33.2"
authors = ["Clément Renault <clement@meilisearch.com>"]
edition = "2018"
publish = false

View File

@ -1,6 +1,6 @@
[package]
name = "infos"
version = "0.33.1"
version = "0.33.2"
authors = ["Clément Renault <clement@meilisearch.com>"]
edition = "2018"
publish = false

View File

@ -1,6 +1,6 @@
[package]
name = "json-depth-checker"
version = "0.33.1"
version = "0.33.2"
edition = "2021"
description = "A library that indicates if a JSON must be flattened"
publish = false

View File

@ -1,6 +1,6 @@
[package]
name = "milli"
version = "0.33.1"
version = "0.33.2"
authors = ["Kerollmops <clement@meilisearch.com>"]
edition = "2018"

View File

@ -1,5 +1,5 @@
use std::borrow::Cow;
use std::cmp::min;
use std::cmp::max;
use std::{cmp, fmt, mem};
use charabia::classifier::ClassifiedTokenIter;
@ -450,14 +450,14 @@ fn create_query_tree(
}
let number_phrases = query.iter().filter(|p| p.is_phrase()).count();
let remove_count = query.len() - min(number_phrases, 1);
let remove_count = query.len() - max(number_phrases, 1);
if remove_count == 0 {
return ngrams(ctx, authorize_typos, query, false);
}
let mut operation_children = Vec::new();
let mut query = query.to_vec();
for _ in 0..remove_count {
for _ in 0..=remove_count {
let pos = match terms_matching_strategy {
TermsMatchingStrategy::All => return ngrams(ctx, authorize_typos, &query, false),
TermsMatchingStrategy::Any => {
@ -1058,6 +1058,26 @@ mod test {
"###);
}
#[test]
fn phrase_2() {
// https://github.com/meilisearch/meilisearch/issues/2722
let query = "coco \"harry\"";
let tokens = query.tokenize();
let (query_tree, _) = TestContext::default()
.build(TermsMatchingStrategy::default(), true, None, tokens)
.unwrap()
.unwrap();
insta::assert_debug_snapshot!(query_tree, @r###"
OR(WORD)
Exact { word: "harry" }
AND
Exact { word: "coco" }
Exact { word: "harry" }
"###);
}
#[test]
fn phrase_with_hard_separator() {
let query = "\"hey friends. wooop wooop\"";