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

Datahub: Add generic "keyword" filter with translated values #782

Merged
merged 10 commits into from
Mar 13, 2024

Conversation

jahow
Copy link
Collaborator

@jahow jahow commented Jan 26, 2024

Description

This PR introduces a generic keyword filter. Unlike the INSPIRE keyword filter which fetches translation dynamically from the GeoNetwork API, the keyword filter simply looks at either tag.default or tag.langxyz fields depending on whether a hardcoded metadata language is defined in the configuration.

This PR also simplifies the implementation of both topics and INSPIRE keyword filters by introducing a TranslatedSearchField class which relies on the platform service to show a label in the correct language.

Architectural changes

No significant changes.

Screenshots

image

Quality Assurance Checklist

  • Commit history is devoid of any merge commits and readable to facilitate reviews
  • If new logic ⚙️ is introduced: unit tests were added
  • If new user stories 🤏 are introduced: E2E tests were added
  • If new UI components 🕹️ are introduced: corresponding stories in Storybook were created
  • If breaking changes 🪚 are introduced: add the breaking change label
  • If bugs 🐞 are fixed: add the backport <release branch> label
  • The documentation website 📚 has received the love it deserves

This work is sponsored by Swisstopo / Geocat.ch.

Copy link
Contributor

github-actions bot commented Jan 26, 2024

Affected libs: api-repository, feature-catalog, feature-record, feature-router, feature-search, feature-map, feature-dataviz, feature-auth, common-domain, api-metadata-converter, feature-editor, ui-search, common-fixtures, util-shared, ui-elements, ui-catalog, ui-widgets, ui-inputs, ui-layout, ui-map, ui-dataviz,
Affected apps: metadata-editor, datahub, demo, webcomponents, map-viewer, search, datafeeder, metadata-converter, data-platform,

  • 🚀 Build and deploy storybook and demo on GitHub Pages
  • 📦 Build and push affected docker images

@coveralls
Copy link

coveralls commented Jan 26, 2024

Coverage Status

coverage: 83.342% (+0.1%) from 83.241%
when pulling 27ae152 on add-generic-keyword-filter
into 1533e02 on main.

@jahow jahow force-pushed the add-generic-keyword-filter branch 2 times, most recently from d4215ab to 65319d0 Compare January 29, 2024 13:01
Copy link
Member

@fgravin fgravin left a comment

Choose a reason for hiding this comment

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

Not looked at the code yet but just tested a bit, some issues on geocat dev for instance:

  • the limit of 1000 for the tag facet is not enough as there are more than 1000 keywords
  • the limit of 1000 for thesaurus keys is not enough for http://www.eionet.europa.eu/gemet/concept thesaurus
  • the runtime_mapping slows a lot the request
  • the runtime_mapping is present in all state search request payloads, which makes the search very slow, even when the runtime is not needed
  • could be some issues, for instance opendata.swiss which have 2 entries, one for the keywords from the thesaurus, one for the same keyword which is not in the thesaurus
  • opendata.swiss entries sum count is not the same as the same facet in gn legacy ui 900 + 1149 != 2566
  • might be better to sort alphabetically

I think our method is accurate, but leads to some inconsistency and is slower than just targeting an index entry (eg tag.langfre)
Might need to talk with Benoit about what is the best tradeoff.

@jahow
Copy link
Collaborator Author

jahow commented Feb 1, 2024

You're right, the performance on the keyword fields with runtime mappings is abysmal on large catalogs, I didn't even realize that. We could use the pipeline system to register a scripted field specifically for keywords, and use it if available to improve the results. If not available, we can just target a lang<xxx> field according to the UI language.

As for the GEMET concepts, the thesaurus contains more than 1000 entries so currently some won't be fetched; I thought about doing pagination on these queries, not sure yet. Maybe this is going too far in terms of trying to improve the search results.

I'm going to leave this PR for now and will revisit it later; I'll create another PR to extract the changes to the docker composition though, because this will improve e2e tests.

@jahow jahow added the on hold Work has been temporarily halted label Feb 1, 2024
Copy link
Contributor

github-actions bot commented Feb 1, 2024

GitHub Pages links:

  • (Documentation)[https://geonetwork.github.io/geonetwork-ui/add-generic-keyword-filter/docs/]
  • (Demo & web components)[https://geonetwork.github.io/geonetwork-ui/add-generic-keyword-filter/demo/]
  • (UI components storybook)[https://geonetwork.github.io/geonetwork-ui/add-generic-keyword-filter/storybook/demo/]

@jahow jahow removed the on hold Work has been temporarily halted label Feb 19, 2024
@fgravin fgravin added the on hold Work has been temporarily halted label Feb 27, 2024
@jahow jahow force-pushed the add-generic-keyword-filter branch from 65319d0 to 0ec742a Compare March 9, 2024 21:58
@jahow jahow removed the on hold Work has been temporarily halted label Mar 9, 2024
… on the keyword URIs

Also read the description from the keywords, just in case
…eric keyword field

The INSPIRE keyword field now also uses the same TranslateSearchField
implementation, since the thesaurus loading is done behind the scenes by
the Platform service.
@jahow jahow force-pushed the add-generic-keyword-filter branch from 0ec742a to e082a9a Compare March 9, 2024 22:06
@jahow
Copy link
Collaborator Author

jahow commented Mar 9, 2024

I have reworked the PR to not rely on pipelines or runtime fields, and simply look for either tag.default or tag.langxyz depending on whether a fixed metadata language is defined in the config.

This is ready for review, although I still have to add documentation on the topic.

Multilingual fields rely on different fields depending on the current
defined metadata language
@jahow jahow force-pushed the add-generic-keyword-filter branch from e082a9a to 3caa5cf Compare March 9, 2024 22:19
@jahow jahow force-pushed the add-generic-keyword-filter branch from 2650967 to d59d9f8 Compare March 9, 2024 23:00
Copy link
Member

@fgravin fgravin left a comment

Choose a reason for hiding this comment

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

The code looks good.
I've tested the keyword and works well, but the inspireKeyword list is empty, on geocat dev.

@jahow
Copy link
Collaborator Author

jahow commented Mar 11, 2024

The code looks good. I've tested the keyword and works well, but the inspireKeyword list is empty, on geocat dev.

Thanks, there was indeed a regression on the inspire keywords. I've added E2E tests for all the new filters to make sure this does not happen again.

Copy link
Collaborator

@Angi-Kinas Angi-Kinas left a comment

Choose a reason for hiding this comment

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

Thanks @jahow ! I manually tested it and it LGTM! 🚀

@jahow jahow force-pushed the add-generic-keyword-filter branch from 77d8b0a to 27ae152 Compare March 13, 2024 13:00
@jahow jahow merged commit 1189d39 into main Mar 13, 2024
9 checks passed
@jahow jahow deleted the add-generic-keyword-filter branch March 13, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants