mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-29 16:24:26 +01:00
Merge #620
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:
commit
f7c352a32d
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "benchmarks"
|
name = "benchmarks"
|
||||||
version = "0.33.1"
|
version = "0.33.2"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cli"
|
name = "cli"
|
||||||
version = "0.33.1"
|
version = "0.33.2"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "A CLI to interact with a milli index"
|
description = "A CLI to interact with a milli index"
|
||||||
publish = false
|
publish = false
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "filter-parser"
|
name = "filter-parser"
|
||||||
version = "0.33.1"
|
version = "0.33.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "The parser for the Meilisearch filter syntax"
|
description = "The parser for the Meilisearch filter syntax"
|
||||||
publish = false
|
publish = false
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "flatten-serde-json"
|
name = "flatten-serde-json"
|
||||||
version = "0.33.1"
|
version = "0.33.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Flatten serde-json objects like elastic search"
|
description = "Flatten serde-json objects like elastic search"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "helpers"
|
name = "helpers"
|
||||||
version = "0.33.1"
|
version = "0.33.2"
|
||||||
authors = ["Clément Renault <clement@meilisearch.com>"]
|
authors = ["Clément Renault <clement@meilisearch.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "A small tool to do operations on the database"
|
description = "A small tool to do operations on the database"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "http-ui"
|
name = "http-ui"
|
||||||
description = "The HTTP user interface of the milli search engine"
|
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>"]
|
authors = ["Clément Renault <clement@meilisearch.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "infos"
|
name = "infos"
|
||||||
version = "0.33.1"
|
version = "0.33.2"
|
||||||
authors = ["Clément Renault <clement@meilisearch.com>"]
|
authors = ["Clément Renault <clement@meilisearch.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "json-depth-checker"
|
name = "json-depth-checker"
|
||||||
version = "0.33.1"
|
version = "0.33.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "A library that indicates if a JSON must be flattened"
|
description = "A library that indicates if a JSON must be flattened"
|
||||||
publish = false
|
publish = false
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "milli"
|
name = "milli"
|
||||||
version = "0.33.1"
|
version = "0.33.2"
|
||||||
authors = ["Kerollmops <clement@meilisearch.com>"]
|
authors = ["Kerollmops <clement@meilisearch.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cmp::min;
|
use std::cmp::max;
|
||||||
use std::{cmp, fmt, mem};
|
use std::{cmp, fmt, mem};
|
||||||
|
|
||||||
use charabia::classifier::ClassifiedTokenIter;
|
use charabia::classifier::ClassifiedTokenIter;
|
||||||
@ -450,14 +450,14 @@ fn create_query_tree(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let number_phrases = query.iter().filter(|p| p.is_phrase()).count();
|
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 {
|
if remove_count == 0 {
|
||||||
return ngrams(ctx, authorize_typos, query, false);
|
return ngrams(ctx, authorize_typos, query, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut operation_children = Vec::new();
|
let mut operation_children = Vec::new();
|
||||||
let mut query = query.to_vec();
|
let mut query = query.to_vec();
|
||||||
for _ in 0..remove_count {
|
for _ in 0..=remove_count {
|
||||||
let pos = match terms_matching_strategy {
|
let pos = match terms_matching_strategy {
|
||||||
TermsMatchingStrategy::All => return ngrams(ctx, authorize_typos, &query, false),
|
TermsMatchingStrategy::All => return ngrams(ctx, authorize_typos, &query, false),
|
||||||
TermsMatchingStrategy::Any => {
|
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]
|
#[test]
|
||||||
fn phrase_with_hard_separator() {
|
fn phrase_with_hard_separator() {
|
||||||
let query = "\"hey friends. wooop wooop\"";
|
let query = "\"hey friends. wooop wooop\"";
|
||||||
|
Loading…
Reference in New Issue
Block a user