mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 15:26:30 +03:00
improve repl message search
- allow spaces in queries - show query and scope below result
This commit is contained in:
@@ -932,13 +932,24 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
|
|||||||
"listmsgs" => {
|
"listmsgs" => {
|
||||||
ensure!(!arg1.is_empty(), "Argument <query> missing.");
|
ensure!(!arg1.is_empty(), "Argument <query> missing.");
|
||||||
|
|
||||||
|
let query = format!("{} {}", arg1, arg2).trim().to_string();
|
||||||
let chat = sel_chat.as_ref().map(|sel_chat| sel_chat.get_id());
|
let chat = sel_chat.as_ref().map(|sel_chat| sel_chat.get_id());
|
||||||
let time_start = std::time::SystemTime::now();
|
let time_start = std::time::SystemTime::now();
|
||||||
let msglist = context.search_msgs(chat, arg1).await?;
|
let msglist = context.search_msgs(chat, &query).await?;
|
||||||
let time_needed = time_start.elapsed().unwrap_or_default();
|
let time_needed = time_start.elapsed().unwrap_or_default();
|
||||||
|
|
||||||
log_msglist(&context, &msglist).await?;
|
log_msglist(&context, &msglist).await?;
|
||||||
println!("{} messages.", msglist.len());
|
println!(
|
||||||
|
"{}{} messages for {}search of \"{}\"",
|
||||||
|
msglist.len(),
|
||||||
|
if msglist.len() == 1000 { "+" } else { "" },
|
||||||
|
if chat.is_none() {
|
||||||
|
"global "
|
||||||
|
} else {
|
||||||
|
"in-chat-"
|
||||||
|
},
|
||||||
|
query,
|
||||||
|
);
|
||||||
println!("{:?} to create this list", time_needed);
|
println!("{:?} to create this list", time_needed);
|
||||||
}
|
}
|
||||||
"draft" => {
|
"draft" => {
|
||||||
|
|||||||
Reference in New Issue
Block a user