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

EntityCluster hasLabelIndex always returns false #7446

Open
OmarShehata opened this issue Jan 2, 2019 · 2 comments
Open

EntityCluster hasLabelIndex always returns false #7446

OmarShehata opened this issue Jan 2, 2019 · 2 comments
Labels
good first issue An opportunity for first time contributors type - bug

Comments

@OmarShehata
Copy link
Contributor

This was reported on the forum with a suggested fix but I haven't had a chance to try it out and investigate it further so I'm documenting it here.

The Problem

This is the hasLabelIndex function in EntityCluster.js:

function hasLabelIndex(entityCluster, entityId) {
   return defined(entityCluster) && defined(entityCluster._collectionIndicesByEntity[entityId]) && defined(entityCluster._collectionIndicesByEntity[entityId].labelIndex);
}

The supplied entityId is an object, not a string, so defined(entityCluster._collectionIndicesByEntity[entityId]) will always be false.

Suggested Fix

I think the problem is that in addNonClusteredItem and getBoundingBox, it passes item.id as the entityId, but that's actually the entity itself. Instead, it should perhaps pass item.id.id.

It would be good to also write a test that would start out failing and is fixed after this is fixed.

How To Test

What I did to see that this was happening was launch the test suite on the EntityCluster class (using http://localhost:8080/Specs/SpecRunner.html?spec=DataSources%2FEntityCluster) and placing a console.log to see that it does indeed always return false, and passes an object instead of a string.

@hpinkos maybe we can label this "Good First Issue" ?

@mramato
Copy link
Contributor

mramato commented Jan 2, 2019

Given we've had various issues with clustering, this sounds like something that should be fixed sooner rather than later. Do we understand how this bug manifests in actual clustering behavior?

@OmarShehata
Copy link
Contributor Author

Based on the report in the forum thread, it causes labels to not be clustered. I haven't had a chance to confirm this however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An opportunity for first time contributors type - bug
Projects
None yet
Development

No branches or pull requests

3 participants