Skip to content

Commit f41ceaf

Browse files
committed
fix: search
1 parent 2debfab commit f41ceaf

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

src/api/post/search.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::infra::json;
55
use crate::infra::result::IntoResult;
66
use anyhow::Result;
77
use serde::{Deserialize, Serialize};
8+
use std::collections::HashSet;
89

910
impl Post {
1011
pub async fn search(
@@ -102,6 +103,8 @@ impl Post {
102103
.collect::<Result<Vec<_>>>()?
103104
.into_iter()
104105
.flatten()
106+
.collect::<HashSet<_>>()
107+
.into_iter()
105108
.collect::<Vec<_>>();
106109

107110
(id_list, total_count).into_ok()

src/args/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ pub fn search_post(args: &Args) -> Option<Result<(String, &String, usize, usize)
273273
show: false,
274274
show_meta: false,
275275
list: false,
276-
delete: true,
276+
delete: false,
277277
search: Some(keyword),
278278
})),
279279
id: None,

src/display/colorful.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,5 +165,5 @@ pub fn search_post(id_list: &[usize], total_count: usize, rev: bool) {
165165
id_list
166166
.iter()
167167
.dyn_rev(rev)
168-
.for_each(|id| println!("# {}", id));
168+
.for_each(|id| println!("{}", id));
169169
}

src/display/normal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,5 @@ pub fn search_post(id_list: &[usize], total_count: usize, rev: bool) {
163163
id_list
164164
.iter()
165165
.dyn_rev(rev)
166-
.for_each(|id| println!("# {}", id));
166+
.for_each(|id| println!("{}", id));
167167
}

0 commit comments

Comments
 (0)