feat(server): busca FTS5 com filtros e paginacao
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
use ares_server::search::fts_query;
|
||||
|
||||
#[test]
|
||||
fn empty_query_returns_none() {
|
||||
assert_eq!(fts_query(""), None);
|
||||
assert_eq!(fts_query(" "), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn single_term_wrapped_in_quotes() {
|
||||
assert_eq!(fts_query("musica").unwrap(), "\"musica\"");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multiple_terms_are_and() {
|
||||
assert_eq!(fts_query("bossa nova").unwrap(), "\"bossa\" AND \"nova\"");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn non_whitespace_tokens_split_kept() {
|
||||
// tokens are split by whitespace; edge chars (like *) are stripped
|
||||
assert_eq!(fts_query("*ideal* fluido*").unwrap(), "\"ideal\" AND \"fluido\"");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fts_special_single_char_stripped_at_edges() {
|
||||
assert_eq!(fts_query("album' rock").unwrap(), "\"album\" AND \"rock\"");
|
||||
}
|
||||
Reference in New Issue
Block a user