mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 05:00:06 +01:00
Add test that fails before PR and passes now
This commit is contained in:
parent
73198179f1
commit
1dfc4038ab
@ -284,3 +284,36 @@ impl PhraseBuilder {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use charabia::TokenizerBuilder;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
use crate::index::tests::TempIndex;
|
||||||
|
|
||||||
|
fn temp_index_with_documents() -> TempIndex {
|
||||||
|
let temp_index = TempIndex::new();
|
||||||
|
temp_index
|
||||||
|
.add_documents(documents!([
|
||||||
|
{ "id": 1, "name": "split this world westfali westfalia the Ŵôřlḑôle" },
|
||||||
|
{ "id": 2, "name": "Westfália" },
|
||||||
|
{ "id": 3, "name": "Ŵôřlḑôle" },
|
||||||
|
]))
|
||||||
|
.unwrap();
|
||||||
|
temp_index
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn start_with_hard_separator() -> Result<()> {
|
||||||
|
let tokenizer = TokenizerBuilder::new().build();
|
||||||
|
let tokens = tokenizer.tokenize(".");
|
||||||
|
let index = temp_index_with_documents();
|
||||||
|
let rtxn = index.read_txn()?;
|
||||||
|
let mut ctx = SearchContext::new(&index, &rtxn);
|
||||||
|
// panics with `attempt to add with overflow` before <https://github.com/meilisearch/meilisearch/issues/3785>
|
||||||
|
let located_query_terms = located_query_terms_from_tokens(&mut ctx, tokens, None)?;
|
||||||
|
assert!(located_query_terms.is_empty());
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user