Parallel indexing
All checks were successful
CI / Typos (push) Successful in 23s
CI / Clippy (push) Successful in 50s
CI / Build and test (push) Successful in 2m9s

This commit is contained in:
2026-02-21 21:37:45 -08:00
parent bf1241e0a5
commit 816100e9a3
10 changed files with 197 additions and 65 deletions

View File

@@ -15,7 +15,7 @@ use crate::{Item, Key};
#[derive(Debug, Clone)]
pub struct FtsLookupResult {
pub score: f32,
pub source_name: String,
pub source_name: Label,
pub key: String,
}
@@ -87,7 +87,9 @@ impl DbFtsIndex {
let json = item.json()?;
let mut empty = true;
for name in self.fts_cfg().fields.keys() {
let val = match self.get_field(&json, name)? {
let x = self.get_field(&json, name)?;
let val = match x {
Some(x) => x,
None => continue,
};
@@ -246,7 +248,6 @@ impl DbFtsIndex {
return Ok(Vec::new());
}
let query: String = query.into();
let index = Index::open_in_dir(&self.path)?;
let reader = index
.reader_builder()
@@ -260,6 +261,7 @@ impl DbFtsIndex {
fields.push(f.0)
}
let query: String = query.into();
let searcher = reader.searcher();
let query_parser = QueryParser::for_index(&index, fields);
let query = query_parser.parse_query(&query)?;
@@ -277,6 +279,7 @@ impl DbFtsIndex {
for v in retrieved_doc.get_all(f_source) {
assert!(source.is_none()); // Must only exist once
let v = v.as_str().unwrap().to_owned();
let v = Label::new(v).unwrap();
source = Some(v)
}