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

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

Closed
4 tasks done
MortenHofft opened this issue Jan 11, 2022 · 5 comments
Closed
4 tasks done
Assignees
Labels
Section: Data exploration Has to do with the react components for data exploration Type: Enhancement New feature or request

Comments

@MortenHofft
Copy link
Member

MortenHofft commented Jan 11, 2022

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:

  • update es wrapper config to match latest field names
  • change GraphQL implementation to use the other endpoint
  • change the react components to use predicate queries instead of APIv1.
  • change the hosted portals that use the current version (it has been advertised as unstable).
@MortenHofft MortenHofft added Type: Enhancement New feature or request Section: Data exploration Has to do with the react components for data exploration labels Jan 11, 2022
@MortenHofft MortenHofft self-assigned this Jan 11, 2022
@MortenHofft
Copy link
Member Author

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
Copy link
Member Author

MortenHofft commented Jan 27, 2022

@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
Copy link

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
Copy link
Member Author

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
Copy link

albenson-usgs commented Feb 2, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Section: Data exploration Has to do with the react components for data exploration Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants