Skip to content

Commit

Permalink
Fix pagerank filter
Browse files Browse the repository at this point in the history
  • Loading branch information
dcadenas committed Sep 18, 2024
1 parent 361800c commit 8a5f16b
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 7 deletions.
98 changes: 98 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ axum = "0.7.5"
cached = { version = "0.53.1", features = ["async"] }
chrono = { version = "0.4.38", features = ["serde"] }
config_rs = { version = "0.14", package = "config", features = ["yaml"] }
env_logger = "0.11.5"
futures = "0.3.30"
gcloud-sdk = { version = "0.25.6", features = ["google-pubsub-v1"] }
log = "0.4.22"
metrics = "0.23.0"
metrics-exporter-prometheus = "0.15.3"
neo4rs = "0.8.0"
Expand Down
10 changes: 4 additions & 6 deletions src/bin/pagerank.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
use anyhow::{Context, Result};
use log::{error, info};
use neo4rs::Graph;
use nos_followers::{
config::{Config, Settings},
repo::{Repo, RepoTrait},
};
use std::sync::Arc;
use tracing::{error, info};
use tracing_subscriber::{fmt, prelude::*, EnvFilter};

#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::registry()
.with(fmt::layer())
.with(EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")))
.init();
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init();

info!("PageRank updater started");

Expand All @@ -40,5 +36,7 @@ async fn main() -> Result<()> {
}

info!("PageRank update completed successfully");

log::logger().flush();
Ok(())
}
4 changes: 3 additions & 1 deletion src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,12 @@ impl RepoTrait for Repo {
WITH graphName
MATCH (n:User)
WHERE n.followee_count > 1 AND n.follower_count > 0
OPTIONAL MATCH (n)-[r:FOLLOWS]->(m:User)
WHERE m.followee_count > 1 AND m.follower_count > 0
WITH gds.graph.project(
graphName,
n,
n,
m,
{
relationshipType: 'FOLLOWS',
relationshipProperties: {}
Expand Down

0 comments on commit 8a5f16b

Please sign in to comment.