Skip to content

web search done right

'optimize_for_search' actually seemed to make the searches slower as too many threads would fight for io access at once

Mikkel Denker7919df0863ff
diff --git a/crates/core/src/index.rs b/crates/core/src/index.rs
index 8858bbc1..73cf0906 100644
--- a/crates/core/src/index.rs
+++ b/crates/core/src/index.rs
@@ -58,12 +58,6 @@ impl Index {
})
}
- pub fn optimize_for_search(&mut self) -> Result<()> {
- self.inverted_index.optimize_for_search()?;
-
- Ok(())
- }
-
pub fn set_auto_merge_policy(&mut self) {
self.inverted_index.set_auto_merge_policy();
}
diff --git a/crates/core/src/inverted_index.rs b/crates/core/src/inverted_index.rs
index 0790c245..f4a16534 100644
--- a/crates/core/src/inverted_index.rs
+++ b/crates/core/src/inverted_index.rs
@@ -653,12 +653,6 @@ impl InvertedIndex {
res.pop()
.map(|(_, doc)| self.retrieve_doc(doc.into(), &tv_searcher).unwrap())
}
-
- pub fn optimize_for_search(&mut self) -> Result<()> {
- self.tantivy_index.set_default_multithread_executor()?;
-
- Ok(())
- }
}
#[derive(Debug, Serialize)]
diff --git a/crates/core/src/searcher/local.rs b/crates/core/src/searcher/local.rs
index cc74e305..90f98e3a 100644
--- a/crates/core/src/searcher/local.rs
+++ b/crates/core/src/searcher/local.rs
@@ -42,7 +42,6 @@ pub trait SearchableIndex {
Self: 'a;
fn guard(&self) -> Self::SearchGuard<'_>;
- fn optimize_for_search(&mut self);
fn set_snippet_config(&mut self, config: SnippetConfig);
}
@@ -60,10 +59,6 @@ impl SearchableIndex for Index {
NormalIndexSearchGuard { search_index: self }
}
- fn optimize_for_search(&mut self) {
- self.optimize_for_search().unwrap();
- }
-
fn set_snippet_config(&mut self, config: SnippetConfig) {
self.inverted_index.set_snippet_config(config);
}
@@ -88,10 +83,6 @@ impl SearchableIndex for Arc<live_index::Index> {
}
}
- fn optimize_for_search(&mut self) {
- self.write().optimize_for_search().unwrap();
- }
-
fn set_snippet_config(&mut self, config: SnippetConfig) {
self.write().inverted_index.set_snippet_config(config);
}
@@ -135,9 +126,6 @@ where
I: SearchableIndex,
{
pub fn new(index: I) -> Self {
- let mut index = index;
- index.optimize_for_search();
-
LocalSearcher {
index,
inbound_similarity: None,