aboutsummaryrefslogtreecommitdiff
path: root/src/modules/search.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-04-27 01:17:32 -0700
committerFuwn <[email protected]>2022-04-27 01:17:32 -0700
commitc81eab0c3b4fa8d8433505bd3d061f8de8e87d74 (patch)
tree09451b5ebec415295d63504e9eaffecb37277a68 /src/modules/search.rs
parentrefactor(modules): move search out of module (diff)
downloadlocus-c81eab0c3b4fa8d8433505bd3d061f8de8e87d74.tar.xz
locus-c81eab0c3b4fa8d8433505bd3d061f8de8e87d74.zip
refactor: restrict more
Diffstat (limited to 'src/modules/search.rs')
-rw-r--r--src/modules/search.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/modules/search.rs b/src/modules/search.rs
index 57f2c0c..15d0061 100644
--- a/src/modules/search.rs
+++ b/src/modules/search.rs
@@ -22,6 +22,7 @@ use tantivy::schema;
use tempfile::TempDir;
const SEARCH_INDEX_SIZE: usize = 10_000_000;
+const SEARCH_SIZE: usize = 10;
static INDEX_PATH: SyncLazy<Mutex<TempDir>> =
SyncLazy::new(|| Mutex::new(TempDir::new().unwrap()));
@@ -89,7 +90,7 @@ pub(super) fn module(router: &mut windmark::Router) {
)
.parse_query(&query.0.to_string())
.unwrap(),
- &tantivy::collector::TopDocs::with_limit(crate::SEARCH_SIZE),
+ &tantivy::collector::TopDocs::with_limit(SEARCH_SIZE),
)
.unwrap();
@@ -170,7 +171,7 @@ pub fn index() {
let time = tokio::time::Instant::now();
let mut new = 0;
- for (route_path, information) in &(*crate::ROUTES.lock().unwrap()) {
+ for (route_path, information) in &(*crate::route::ROUTES.lock().unwrap()) {
// Pretty inefficient, but I'll figure this out later.
(*INDEX_WRITER.lock().unwrap())
.delete_all_documents()