web search done right
if we always flush before calling .edges(), we cannot iterate the edges of a graph that is opened as read-only
Mikkel Denkera24da43546fc
diff --git a/src/webgraph/graph_store.rs b/src/webgraph/graph_store.rsindex 56e59951..a1984b52 100644--- a/src/webgraph/graph_store.rs+++ b/src/webgraph/graph_store.rs@@ -280,12 +280,12 @@ impl<S: Store> GraphStore<S> {}pub fn edges(&self) -> EdgeIterator<'_> {- self.flush();-EdgeIterator::new(&self.adjacency)}pub fn append(&mut self, other: GraphStore<S>) {+ other.flush();+for edge in other.edges() {let from = other.id2node(&edge.from).expect("node not found");let to = other.id2node(&edge.to).expect("node not found");diff --git a/src/webgraph/mod.rs b/src/webgraph/mod.rsindex d9c55320..a5993a48 100644--- a/src/webgraph/mod.rs+++ b/src/webgraph/mod.rs@@ -102,8 +102,6 @@ pub struct EdgeIterator<'a> {impl<'a> EdgeIterator<'a> {fn new(adjacency: &'a Mutex<Adjacency>) -> EdgeIterator<'a> {- adjacency.lock().unwrap().tree.inner.flush();-let blocks: Vec<_> = adjacency.lock().unwrap()