mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 12:54: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]
|
||||
name = "benchmarks"
|
||||
version = "0.33.1"
|
||||
version = "0.33.2"
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "milli"
|
||||
version = "0.33.1"
|
||||
version = "0.33.2"
|
||||
authors = ["Kerollmops <clement@meilisearch.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
@ -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\"";
|
||||
|
Loading…
Reference in New Issue
Block a user