-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fix: Federated search/browse
results count by portal
#870
Conversation
Federated search/browse
results count by portal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
app/helpers/federation_helper.rb
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?:\/\//, '') |
There was a problem hiding this comment.
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/"
There was a problem hiding this comment.
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?:\/\//, '') |
There was a problem hiding this comment.
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.
Related issue: #859
Changes
(9f0fee8) (5f460ff)
Screenshots:
Federated browse
![image](https://private-user-images.githubusercontent.com/61744974/389658436-f5cd1519-6591-469b-8052-ae0cb7b5d96d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNjU3NTYsIm5iZiI6MTczOTE2NTQ1NiwicGF0aCI6Ii82MTc0NDk3NC8zODk2NTg0MzYtZjVjZDE1MTktNjU5MS00NjliLTgwNTItYWUwY2I3YjVkOTZkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA1MzA1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA3OWJhZWQ2MjAxZDBjM2E3YmNhMzhmMTU4NjUyM2FkYmNlOWU3MDNlYmY3MWFmOTFmMGFlZjc0OGRjN2U3YTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.hPniWckClcPkcBXRWBSxeSteFCif2AdtBndvY0BxIjA)
Federated search
![image](https://private-user-images.githubusercontent.com/61744974/389658214-446c8554-4c3b-4308-81a7-84cbac3ed218.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNjU3NTYsIm5iZiI6MTczOTE2NTQ1NiwicGF0aCI6Ii82MTc0NDk3NC8zODk2NTgyMTQtNDQ2Yzg1NTQtNGMzYi00MzA4LTgxYTctODRjYmFjM2VkMjE4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA1MzA1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFlYjI4ZGYzNGViMzU0Nzk3OGJiN2NmZTQ4YTE1MzAzODQzOWYxZjg2NTU1NjQwNGJmNzdmMTIxOGY3MGE3NGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.SXQlvLc30fwVzGeqgsJdL__lHmSoh1FMajNQHCh0k9Q)