Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(service): re-enable index counts #226

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SHAcollision
Copy link
Collaborator

@SHAcollision SHAcollision commented Nov 25, 2024

The main issue faced currently is that user_counts() graph query does not agree with indexed counts. I believe indexed counts is right, but modifying the user_counts() get query to count total given tags without impacting perf seems hard.

Index: 4
image

Graph: 2
image

On a reindex, the index count will start mixing "total tags" and "total distinct labels".

Tried modifying `user_counts() with something like this to no effect.

// Collect outgoing relationships to Users
        OPTIONAL MATCH (u)-[rel_u_user:FOLLOWS|TAGGED]->(other_user:User)
        WITH u,
            sum(CASE WHEN type(rel_u_user) = 'TAGGED' THEN 1 ELSE 0 END) AS user_tags,
            collect(rel_u_user) AS rels_u_user

        // Collect incoming relationships from Users and count tagged
        OPTIONAL MATCH (user_to_u:User)-[rel_user_u:FOLLOWS|TAGGED]->(u)
        WITH u, user_tags, rels_u_user,
            sum(CASE WHEN type(rel_user_u) = 'TAGGED' THEN 1 ELSE 0 END) AS tagged,
            collect(rel_user_u) AS rels_user_u
            ```
Ideas @tipogi ?
# Pre-submission Checklist

> For tests to work you need a working neo4j and redis instance with the example dataset in `docker/db-graph`

- [ ] **Testing**: Implement and pass new tests for the new features/fixes, `cargo test`.
- [ ] **Performance**: Ensure new code has relevant performance benchmarks, `cargo bench`

@SHAcollision SHAcollision added bug Something isn't working 🔮 nexus 🌐 service labels Nov 25, 2024
@SHAcollision SHAcollision self-assigned this Nov 25, 2024
@SHAcollision SHAcollision linked an issue Nov 25, 2024 that may be closed by this pull request
@SHAcollision SHAcollision requested a review from tipogi November 25, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 🔮 nexus 🌐 service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat (service): re-enable counts from index
1 participant