gbif / hosted-portals

Support material for establishing the GBIF Hosted Portals
Apache License 2.0
9 stars 6 forks source link

Migrate literature search to use custom ES wrapper instead of APIv1 #206

Closed MortenHofft closed 2 years ago

MortenHofft commented 2 years ago

Some of the hosted portals have an interest in showing literature related to the portal. E.g. gbif.us would like to show related literature usages. That is literature making USE of US mediated data or is ABOUT US. But with v1 that isn't possible to have as one page. To do so we need a predicate style search for literature similar to occurrence downloads.

For that reason GBIF.us currently have 2 literature search pages. One to search ABOUT and another to search USAGE. That makes for a strange UI.

This can be solved by using the same ES wrapper we use for occurrence search for literature. It is already implemented, but might need to be updated to fit the latest changes in field names.

Steps:

MortenHofft commented 2 years ago

This means that it is now possible to configure litterature search with a predicate and hence have only one literature page that includes the union of FROM and ABOUT.

MortenHofft commented 2 years ago

@albenson-usgs I believe GBIF.us is the only site that use this in production. The old way will continue to work , but if you want only one page with the union of literature, then you should delete on of the 2 pages and change the configuration of the remaining to below.

---
layout: literature
description: Something should go here
permalink: /literature
---
<script>
  var siteConfig = {
  literature: {
    rootFilter: {
      predicate: {
        type: 'or', predicates: [
          {
            type: 'in',
            key: 'countriesOfResearcher',
            values: ['US', 'UM', 'AS', 'FM', 'GU', 'MH', 'MP', 'PR', 'PW', 'VI']
          },
          {
            type: 'in',
            key: 'countriesOfCoverage',
            values: ['US', 'UM', 'AS', 'FM', 'GU', 'MH', 'MP', 'PR', 'PW', 'VI']
          }
        ]
      }
    },
    highlightedFilters: ['q', 'countriesOfResearcher', 'countriesOfCoverage', 'year']
  }
};
</script>
albenson-usgs commented 2 years ago

Does that mean users won't have a way to know whether the article is using observations from the US vs if it's a US researcher that wrote the article? I want to make sure I understand completely before making a decision.

MortenHofft commented 2 years ago

They will not know unless they add that filter no. In your current version that filter is added for them. You could still have 2 links, that just took them to the same page with some filter preset. Something like FROM and ABOUT

The benefit of this approach is that you only have one page for literature. And that it is possible to search for literature coming from e.g. Guam that is about China. You wouldn't be able to do that with your current version.

albenson-usgs commented 2 years ago

Thanks Morten. I want to implement this but it might take me awhile to carve out time to work on this. I have had "Make the literature font bigger" on my task list since back in October and have yet to make that happen so I don't have high hopes for implementing this soon :-/ But thank you for making it possible!