mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-02-22 10:35:44 +08:00
Merge #5346
Some checks failed
Test suite / Test disabled tokenization (push) Has been skipped
Test suite / Tests almost all features (push) Has been skipped
Test suite / Run tests in debug (push) Failing after 2s
Test suite / Run Clippy (push) Failing after 4s
Test suite / Run Rustfmt (push) Failing after 7s
Test suite / Tests on ubuntu-20.04 (push) Failing after 17s
Test suite / Tests on macos-13 (push) Has been cancelled
Test suite / Tests on windows-2022 (push) Has been cancelled
Some checks failed
Test suite / Test disabled tokenization (push) Has been skipped
Test suite / Tests almost all features (push) Has been skipped
Test suite / Run tests in debug (push) Failing after 2s
Test suite / Run Clippy (push) Failing after 4s
Test suite / Run Rustfmt (push) Failing after 7s
Test suite / Tests on ubuntu-20.04 (push) Failing after 17s
Test suite / Tests on macos-13 (push) Has been cancelled
Test suite / Tests on windows-2022 (push) Has been cancelled
5346: Hotfix typo tolerance bug r=Kerollmops a=ManyTheFish # Pull Request ## Related issue Fixes #5240 ## What does this PR do? - Add a test reproducing the bug - fix the bug by relying on the exact_word database ## Explanation The new indexer introduced in V1.12 does not put the exact attributes words in the word FST, but the old indexer was doing it. So 2 fixes were possible: 1) Add the word from the exact-words database in the FST knowing that they should never be retrieved with a typo 2) Make the search check in the exact-word database in addition to the word FST to know if the word exists This PR implements the second fix ## Impact of the bug A word can't be retrieved if it only appears in attributes listed in the `typoTolerance.disableOnAttributes` setting. Co-authored-by: ManyTheFish <many@meilisearch.com>
This commit is contained in:
commit
e937ba90c2
@ -128,6 +128,40 @@ async fn search_with_stop_word() {
|
||||
.await;
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn search_with_typo_settings() {
|
||||
// related to https://github.com/meilisearch/meilisearch/issues/5240
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
|
||||
let (_, code) = index
|
||||
.update_settings(json!({"typoTolerance": { "disableOnAttributes": ["title", "id"]}}))
|
||||
.await;
|
||||
meili_snap::snapshot!(code, @"202 Accepted");
|
||||
|
||||
let documents = DOCUMENTS.clone();
|
||||
let (task, _status_code) = index.add_documents(documents, None).await;
|
||||
index.wait_task(task.uid()).await.succeeded();
|
||||
|
||||
index
|
||||
.search(json!({"q": "287947" }), |response, code| {
|
||||
assert_eq!(code, 200, "{}", response);
|
||||
snapshot!(json_string!(response["hits"]), @r###"
|
||||
[
|
||||
{
|
||||
"title": "Shazam!",
|
||||
"id": "287947",
|
||||
"color": [
|
||||
"green",
|
||||
"blue"
|
||||
]
|
||||
}
|
||||
]
|
||||
"###);
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn phrase_search_with_stop_word() {
|
||||
// related to https://github.com/meilisearch/meilisearch/issues/3521
|
||||
|
@ -215,7 +215,7 @@ pub fn partially_initialized_term_from_word(
|
||||
let mut zero_typo = None;
|
||||
let mut prefix_of = BTreeSet::new();
|
||||
|
||||
if fst.contains(word) {
|
||||
if fst.contains(word) || ctx.index.exact_word_docids.get(ctx.txn, word)?.is_some() {
|
||||
zero_typo = Some(word_interned);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user