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

Duplicates in search facets #182

Open
JonathanJustavino opened this issue Jul 4, 2024 · 2 comments
Open

Duplicates in search facets #182

JonathanJustavino opened this issue Jul 4, 2024 · 2 comments
Labels
bug Something isn't working User Interface

Comments

@JonathanJustavino
Copy link

Artifact section displays only a subset of the available artifacts and sometime displays duplicates.

Potential bug here in facets-view.js at line 144
uriToName cuts off part of the artifact name when there is a "." in the artifact name

  // Fix artifact facet values for groups, change URIs into artifact names
      var artifactFacetData = ctrl.facetsData[DatabusUris.DATABUS_ARTIFACT_PROPERTY];

      if (artifactFacetData != null) {
        for (var i in artifactFacetData.values) {
          artifactFacetData.values[i] = DatabusUtils.uriToName(artifactFacetData.values[i]);
        }
      }

image_720

@JonathanJustavino JonathanJustavino changed the title Duplicates in the search facets Duplicates in search facets Jul 4, 2024
@JonathanJustavino JonathanJustavino added User Interface bug Something isn't working labels Jul 4, 2024
@thepiyush-303
Copy link

Hello @JonathanJustavino I'm interested in contributing ,
Can you please elaborate.

@mrayushmehrotra
Copy link

 if (
  ctrl.resourceType === "group" &&
  result.data[DatabusUris.DATABUS_ARTIFACT_PROPERTY] !== undefined
) {
  let uniqueValues = new Set();

  result.data[DatabusUris.DATABUS_ARTIFACT_PROPERTY].values = 
    result.data[DatabusUris.DATABUS_ARTIFACT_PROPERTY].values
      .map(value => DatabusUtils.uriToName(value))  // Ensure correct name extraction
      .filter(value => uniqueValues.has(value) ? false : uniqueValues.add(value));
}

maybe we can create a set and return in the facet file,


DatabusUtils.uriToName = function (uri) {
  if (!uri) return "";
  
  // Extracts the last part after the last '/' but keeps dots intact
  return uri.substring(uri.lastIndexOf("/") + 1);
};


and we can modify this UriToName fn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working User Interface
Projects
None yet
Development

No branches or pull requests

3 participants