aboutsummaryrefslogtreecommitdiff
path: root/src/backend/search.rs
diff options
context:
space:
mode:
authorlukeflo2024-10-07 16:15:49 +0200
committerlukeflo2024-10-12 22:41:38 +0200
commitc9e749f811b16f7ec352d2aa8773105af046fad8 (patch)
tree812d5917d968226fb532aad5c6c2d2198d6a4c29 /src/backend/search.rs
parentff539341267df56d99d379066396f63fd7991bd6 (diff)
downloadbibiman-c9e749f811b16f7ec352d2aa8773105af046fad8.tar.gz
bibiman-c9e749f811b16f7ec352d2aa8773105af046fad8.zip
add func for entry items, UI enhancement
- add functions to get url/doi and filepath - get values for entry info from structs not by calling funcs again
Diffstat (limited to 'src/backend/search.rs')
-rw-r--r--src/backend/search.rs29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/backend/search.rs b/src/backend/search.rs
index 7319acc..2c11355 100644
--- a/src/backend/search.rs
+++ b/src/backend/search.rs
@@ -26,7 +26,7 @@ impl Default for BibiSearch {
impl BibiSearch {
// Stringify inner Vec<String> by joining/concat
fn convert_to_string(inner_vec: &Vec<String>) -> String {
- inner_vec.join(" ")
+ inner_vec[0..6].join(" ")
}
// Return a filtered entry list
@@ -89,3 +89,30 @@ impl BibiSearch {
filtered_list
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_vector_join() {
+ let bibvec = vec![
+ "Author".to_string(),
+ "Title".to_string(),
+ "1999".to_string(),
+ "article".to_string(),
+ "hello, bye".to_string(),
+ "author_1999".to_string(),
+ "An abstract with multiple sentences. Sometimes thats necessary".to_string(),
+ "www.bibiman.org".to_string(),
+ "/home/file/path.pdf".to_string(),
+ ];
+
+ let joined_vec = BibiSearch::convert_to_string(&bibvec);
+
+ assert_eq!(
+ joined_vec,
+ "Author Title 1999 article hello, bye author_1999"
+ )
+ }
+}