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: Federated search/browse results count by portal #870

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

Bilelkihal
Copy link
Collaborator

@Bilelkihal Bilelkihal commented Nov 25, 2024

Related issue: #859

Changes

  • Include counting duplicated results for each portal (not only the canonical) in both federated browse and search
    (9f0fee8) (5f460ff)

Screenshots:

Federated browse
image

Federated search
image

@Bilelkihal Bilelkihal changed the title include non canonical portals in counting results for each portal Fix: Federated search/browse results count by portal Nov 25, 2024
@Bilelkihal Bilelkihal self-assigned this Nov 25, 2024
Copy link
Collaborator Author

@Bilelkihal Bilelkihal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bilelkihal Bilelkihal added the enhancement New feature or request label Nov 25, 2024
@@ -234,7 +238,7 @@ def counts_ontology_ids_by_portal_name(portals_ids)
counts[current_portal.downcase] += 1 if id.include?(current_portal.to_s.downcase)

federation_portals.each do |portal|
portal_api = federated_portals[portal.downcase.to_sym][:api]
portal_api = federated_portals[portal.downcase.to_sym][:name].downcase
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a portal's name does not always work. Sometimes, the API URL is not the same as the portal name.
And what did you need to change this line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the search page, to count the results that are in the :other_portals list, we don't have the api url, but instead we have the ui url.
Ok no big deal, to solve this I will just check both like this:
counts[portal.downcase] += 1 if (id.include?(portal_api) || id.include?(portal_ui))

@@ -234,8 +238,9 @@ def counts_ontology_ids_by_portal_name(portals_ids)
counts[current_portal.downcase] += 1 if id.include?(current_portal.to_s.downcase)

federation_portals.each do |portal|
portal_api = federated_portals[portal.downcase.to_sym][:api]
counts[portal.downcase] += 1 if id.include?(portal_api)
portal_api = federated_portals[portal.downcase.to_sym][:api].sub(/^https?:\/\//, '')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@syphax-bouazzouni I added sub(/^https?:\/\//, '') here to make sure to deal with http, https variations.
cause I found for example the ontology STY in earthportal is using http "http://earthportal.eu/ontologies/STY" while the UI link is using https "https://ecoportal.lifewatch.eu/"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sometimes you can even get, an IP, not the actual domain name. but anyway for now good enough.

@@ -234,8 +238,9 @@ def counts_ontology_ids_by_portal_name(portals_ids)
counts[current_portal.downcase] += 1 if id.include?(current_portal.to_s.downcase)

federation_portals.each do |portal|
portal_api = federated_portals[portal.downcase.to_sym][:api]
counts[portal.downcase] += 1 if id.include?(portal_api)
portal_api = federated_portals[portal.downcase.to_sym][:api].sub(/^https?:\/\//, '')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sometimes you can even get, an IP, not the actual domain name. but anyway for now good enough.

@syphax-bouazzouni syphax-bouazzouni merged commit aec6da8 into development Nov 27, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants