Filter ranked search by public source and excluded text before pagination

This commit is contained in:
2026-12-03 03:20:18 +08:00
parent c0b5455582
commit 20d3d3fc62
7 changed files with 113 additions and 8 deletions
+30
View File
@@ -102,3 +102,33 @@ fn type_filter_is_available_in_search_and_page_commands() {
Reply::Help
);
}
#[test]
fn scoped_media_search_keeps_quoted_phrase_and_original_link() {
let mut index = MemoryIndex::default();
for (message, body) in [
(1, "Rust search"),
(2, "Rust search SALE"),
(3, "search Rust"),
] {
index
.upsert(Document {
id: DocumentId::Post { chat: 3, message },
username: PublicName::new("my_feed").unwrap(),
title: String::new(),
body: body.into(),
media: Some(telefind_core::Media::Video),
})
.unwrap();
}
let Reply::Results { total, links } = handle(
&index,
"me",
r#"/page@me 1 type:video from:@My_Feed exclude:sale "rust search""#,
)
.unwrap() else {
panic!("expected a search result")
};
assert_eq!(total, 1);
assert_eq!(links[0].url, "https://t.me/my_feed/1");
}