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

Home page / sort topic categories and INSPIRE themes facets alphabetically #7569

Merged
merged 4 commits into from
Jan 4, 2024

Conversation

josegar74
Copy link
Member

Currently the topic categories and INSPIRE themes filters in the home page seem sorted by the amount of metadata in each category. This change adds support to sort the values alphabetically.

Before:

home-facets-before

After:

home-facets-after

Checklist

  • I have read the contribution guidelines
  • Pull request provided for main branch, backports managed with label
  • Good housekeeping of code, cleaning up comments, tests, and documentation
  • Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
  • Clean commit messages, longer verbose messages are encouraged
  • API Changes are identified in commit messages
  • Testing provided for features or enhancements using automatic tests)
  • User documentation provided for new features or enhancements in manual
  • Build documentation provided for development instructions in README.md files
  • Library management using pom.xml dependency management. Update build documentation with intended library use and library tutorials or documentation

Copy link
Contributor

@MichelGabriel MichelGabriel left a comment

Choose a reason for hiding this comment

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

Tested and works. Thanks!

@josegar74
Copy link
Member Author

When removing in the configuration of the facets orderByTranslation: true, the sorting seem by the internal key, not by the quantity as previously.

Not sure if it's useful to keep the old behaviour with some configuration, what do you think @fxprunayre?

@josegar74
Copy link
Member Author

@fxprunayre I've improved the pull request to use the sorter per facet using the configuration provided: 1da4ec2

Comment on lines 187 to 198

this.sortByQuantity = function (agg, bucket) {
return function (facet) {
return facet.count;
};
};

this.sortByQuantityDesc = function (agg, bucket) {
return function (facet) {
return -1 * facet.count;
};
};
Copy link
Member

Choose a reason for hiding this comment

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

We don't need that as we can sort server side by facet configuration using "order" : { "_count" : "desc" } or "order" : { "_count" : "asc" }. So we can remove this and use the same sort method for all facet directive

Copy link
Member Author

Choose a reason for hiding this comment

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

@fxprunayre updated the pull request with your comments, thanks.

josegar74 and others added 2 commits January 4, 2024 14:54
…ectives/FacetDirective.js

Co-authored-by: François Prunayre <fx.prunayre@gmail.com>
@fxprunayre fxprunayre merged commit 3b3180d into geonetwork:main Jan 4, 2024
6 checks passed
josegar74 added a commit that referenced this pull request Jan 4, 2024
…abetically (#7569)

* Home page / sort topic categories and INSPIRE themes facets alphabetically

* Home page / use facets configuration to sort alphabetically or by quantity

* Update web-ui/src/main/resources/catalog/components/elasticsearch/directives/FacetDirective.js

Co-authored-by: François Prunayre <fx.prunayre@gmail.com>

* Home page / sort topic categories and INSPIRE themes facets alphabetically - remove not required code

---------

Co-authored-by: François Prunayre <fx.prunayre@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants