restore synonyms tests

This commit is contained in:
mpostma 2020-12-02 18:55:39 +01:00 committed by many
parent db64e19b8d
commit a7c88c7951
No known key found for this signature in database
GPG Key ID: 2CEF23B75189EACA
3 changed files with 1165 additions and 1135 deletions

View File

@ -882,7 +882,6 @@ mod tests {
// even try to search for a document
let reader = db.main_read_txn().unwrap();
println!("here");
let SortResult {documents, .. } = index.query_builder().query(&reader, Some("21 "), 0..20).unwrap();
assert_matches!(documents.len(), 1);

File diff suppressed because it is too large Load Diff

View File

@ -147,17 +147,17 @@ fn process_tokens<'a>(tokens: impl Iterator<Item = Token<'a>>) -> impl Iterator<
match token.kind {
TokenKind::Word | TokenKind::StopWord | TokenKind::Any => {
*offset += match *sepkind {
Some(SeparatorKind::Hard) => 8,
Some(SeparatorKind::Soft) => 1,
Some(TokenKind::Separator(SeparatorKind::Hard)) => 8,
Some(_) => 1,
None => 0,
};
*sepkind = None;
*sepkind = Some(token.kind)
}
TokenKind::Separator(SeparatorKind::Hard) => {
*sepkind = Some(SeparatorKind::Hard);
*sepkind = Some(token.kind);
}
TokenKind::Separator(SeparatorKind::Soft) if sepkind.is_none() => {
*sepkind = Some(SeparatorKind::Soft);
*sepkind = Some(token.kind);
}
_ => (),
}