Test coverage and headless nvim bug fixes

This commit is contained in:
Riz Ashraf committed 2026-09-27 08:10:09 +01:00
1 parent bffc8896f1
commit 4bae4e9c08
9 files changed
+316 -58

No files matched your search

+19 -3
View File
@@ -7,8 +7,8 @@ pub type SearchResultTuple = (String, String, String, String, f32);
#[derive(Clone)]
pub struct MemoryIndex {
index: Index,
reader: IndexReader,
pub index: Index,
pub reader: IndexReader,
writer: Arc<Mutex<IndexWriter>>,
needs_commit: Arc<std::sync::atomic::AtomicBool>,
@@ -244,18 +244,32 @@ impl MemoryIndex {
self.type_field => "entity",
self.namespace_field => e.namespace.as_str()
));
self.needs_commit.store(true, std::sync::atomic::Ordering::SeqCst);
}
}
pub fn delete_all(&self) {
if let Ok(mut writer) = self.writer.lock() {
let _ = writer.delete_all_documents();
self.needs_commit.store(true, std::sync::atomic::Ordering::SeqCst);
}
}
pub fn add_task_sync(&self, t: &Task) {
println!("add_task_sync called for task: {}", t.id);
if let Ok(writer) = self.writer.lock() {
let _ = writer.add_document(doc!(
let res = writer.add_document(doc!(
self.id_field => t.id.as_str(),
self.title_field => t.title.as_str(),
self.body_field => t.description.as_str(),
self.type_field => "task",
self.namespace_field => "global"
));
println!("Writer add_document returned id/result");
self.needs_commit.store(true, std::sync::atomic::Ordering::SeqCst);
println!("Needs_commit set to true in add_task_sync");
} else {
println!("Failed to acquire writer lock in add_task_sync");
}
}
@@ -268,6 +282,7 @@ impl MemoryIndex {
self.type_field => "snippet",
self.namespace_field => "global"
));
self.needs_commit.store(true, std::sync::atomic::Ordering::SeqCst);
}
}
@@ -280,6 +295,7 @@ impl MemoryIndex {
self.type_field => "adr",
self.namespace_field => "global"
));
self.needs_commit.store(true, std::sync::atomic::Ordering::SeqCst);
}
}
}