aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-08-16 19:03:22 -0700
committerFuwn <[email protected]>2022-08-16 19:03:22 -0700
commit7c5662db552b9c4e8a1578eb917047980511ccc3 (patch)
tree66904d8af52d2e84aa44df800a81e39c75007eb8 /src/modules
parentfix(main.rs): github actions build error (diff)
downloadlocus-7c5662db552b9c4e8a1578eb917047980511ccc3.tar.xz
locus-7c5662db552b9c4e8a1578eb917047980511ccc3.zip
fix: bump toolchain for github actions
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/search.rs46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/modules/search.rs b/src/modules/search.rs
index 61207d0..2179215 100644
--- a/src/modules/search.rs
+++ b/src/modules/search.rs
@@ -16,7 +16,7 @@
// Copyright (C) 2022-2022 Fuwn <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only
-use std::{lazy::SyncLazy, sync::Mutex};
+use std::{fmt::Write, lazy::SyncLazy, sync::Mutex};
use tantivy::schema;
use tempfile::TempDir;
@@ -104,13 +104,14 @@ pub(super) fn module(router: &mut windmark::Router) {
.unwrap()
.as_text()
.unwrap()
- }};
- ($document:ident, $field:ident) => {{
- $document.get_first($field).unwrap().as_text().unwrap()
- }};
+ }}; /* ($document:ident, $field:ident) => {{
+ * $document.get_first($field).unwrap().as_text().
+ * unwrap() }}; */
}
- results +=
+ let _ = write!(
+ results,
+ "{}",
&format!("=> {} {}{}\n", text!(path), text!(description), {
let mut lines = retrieved_document
.get_first(content)
@@ -135,22 +136,27 @@ pub(super) fn module(router: &mut windmark::Router) {
)
},
)
- });
+ })
+ );
}
- response += &format!(
- "\n\nYou searched for \"{}\"!\n\n## RESULTS\n\n{}\n\nIn need of \
- more results? This search engine populates its index with route \
- paths and route descriptions on startup. However, route content \
- isn't populated until the route is first visited. After a \
- route's first visit, it is updated after every five minutes, at \
- time of visit.",
- query.0,
- if results.is_empty() {
- "There are no results for your query...".to_string()
- } else {
- results.trim_end().to_string()
- },
+ let _ = write!(
+ response,
+ "{}",
+ &format!(
+ "\n\nYou searched for \"{}\"!\n\n## RESULTS\n\n{}\n\nIn need of \
+ more results? This search engine populates its index with \
+ route paths and route descriptions on startup. However, route \
+ content isn't populated until the route is first visited. \
+ After a route's first visit, it is updated after every five \
+ minutes, at time of visit.",
+ query.0,
+ if results.is_empty() {
+ "There are no results for your query...".to_string()
+ } else {
+ results.trim_end().to_string()
+ },
+ )
);
}
}