Skip to content

web search done right

I forgot to pop from cache in webgraph.....

Mikkel Denkerbe4696e57d12
diff --git a/core/src/ranking/inbound_similarity.rs b/core/src/ranking/inbound_similarity.rs
index 50ef44ec..a03c4528 100644
--- a/core/src/ranking/inbound_similarity.rs
+++ b/core/src/ranking/inbound_similarity.rs
@@ -33,7 +33,7 @@ use crate::{
use super::{bitvec_similarity, centrality_store::HarmonicCentralityStore};
const DEFAULT_NUM_TOP_HARMONIC_CENTRALITY_FOR_INBOUND: usize = 2000;
-const DEFAULT_NUM_TOP_HARMONIC_CENTRALITY_FOR_NODES: usize = 10000;
+const DEFAULT_NUM_TOP_HARMONIC_CENTRALITY_FOR_NODES: usize = 1_000_000;
const SCORE_SCALE: f64 = 5.0;
pub struct Scorer {
diff --git a/core/src/webgraph/centrality/online_harmonic.rs b/core/src/webgraph/centrality/online_harmonic.rs
index 96d9f81e..8cba124d 100644
--- a/core/src/webgraph/centrality/online_harmonic.rs
+++ b/core/src/webgraph/centrality/online_harmonic.rs
@@ -41,8 +41,8 @@ use crate::Result;
const NUM_PROXY_NODES: usize = 50;
const BEST_PROXY_NODES_PER_USER_NODE: usize = 3;
const USER_NODES_LIMIT: usize = 100; // if the user specifies more than this number of nodes, the remaining nodes will be merged into existing
-const MAX_DIST_PROXY: u8 = 3;
-const MAX_NUM_OUT_EDGES: usize = 200;
+const MAX_DIST_PROXY: u8 = 5;
+const MAX_NUM_OUT_EDGES: usize = 1000;
pub const SCORE_OFFSET: f64 = 1.0;
#[derive(Serialize, Deserialize)]
diff --git a/core/src/webgraph/segment.rs b/core/src/webgraph/segment.rs
index 5fd5250f..3be12bae 100644
--- a/core/src/webgraph/segment.rs
+++ b/core/src/webgraph/segment.rs
@@ -87,13 +87,16 @@ where
fn update_cache(&self, key: &K) {
if !self.cache.read().unwrap().contains_key(key) {
+ let mut cache = self.cache.write().unwrap();
+
+ while cache.len() >= self.cache_size {
+ cache.pop_first();
+ }
+
let val = self.store.get(key);
if let Some(val) = val {
- self.cache
- .write()
- .unwrap()
- .insert(key.clone(), Arc::new(RwLock::new(val)));
+ cache.insert(key.clone(), Arc::new(RwLock::new(val)));
}
}
}