refactor: eradicate deprecated tools (sticky_notes, pinned_files, context_workspaces, pr_checklist, preferences) and dead code
This commit is contained in:
1 parent
d80915635f
commit
79209da711
31 files changed
+1230
-3920
No files matched your search
+26
-19
@@ -253,15 +253,35 @@ impl MemoryIndex {
|
||||
})?;
|
||||
|
||||
let target_limit = if is_wildcard_fallback { 10 } else { 50 };
|
||||
let fetch_limit = if namespace.is_some() {
|
||||
// Fetch deeper candidate pool so other namespaces do not starve the target namespace
|
||||
1000
|
||||
let final_query: Box<dyn tantivy::query::Query> = if let Some(ns) = namespace {
|
||||
let ns_term_query: Box<dyn tantivy::query::Query> = Box::new(tantivy::query::TermQuery::new(
|
||||
tantivy::Term::from_field_text(self.namespace_field, ns),
|
||||
tantivy::schema::IndexRecordOption::Basic,
|
||||
));
|
||||
let ns_filter: Box<dyn tantivy::query::Query> = if ns != "global" {
|
||||
let global_term_query = Box::new(tantivy::query::TermQuery::new(
|
||||
tantivy::Term::from_field_text(self.namespace_field, "global"),
|
||||
tantivy::schema::IndexRecordOption::Basic,
|
||||
));
|
||||
Box::new(tantivy::query::BooleanQuery::new(vec![
|
||||
(tantivy::query::Occur::Should, ns_term_query),
|
||||
(tantivy::query::Occur::Should, global_term_query),
|
||||
]))
|
||||
} else {
|
||||
ns_term_query
|
||||
};
|
||||
|
||||
Box::new(tantivy::query::BooleanQuery::new(vec![
|
||||
(tantivy::query::Occur::Must, q),
|
||||
(tantivy::query::Occur::Must, ns_filter),
|
||||
]))
|
||||
} else {
|
||||
target_limit
|
||||
q
|
||||
};
|
||||
|
||||
let top_docs = searcher.search(
|
||||
&q,
|
||||
&tantivy::collector::TopDocs::with_limit(fetch_limit).order_by_score(),
|
||||
&final_query,
|
||||
&tantivy::collector::TopDocs::with_limit(target_limit).order_by_score(),
|
||||
)?;
|
||||
|
||||
let mut results = Vec::with_capacity(target_limit);
|
||||
@@ -287,20 +307,7 @@ impl MemoryIndex {
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or("")
|
||||
.to_string();
|
||||
let doc_ns = retrieved_doc
|
||||
.get_first(self.namespace_field)
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or("");
|
||||
if let Some(ns) = namespace
|
||||
&& doc_ns != ns
|
||||
&& doc_ns != "global"
|
||||
{
|
||||
continue;
|
||||
}
|
||||
results.push((id, doc_type, title, body, score));
|
||||
if results.len() >= target_limit {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ok(results)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user