TAMULib / SAGE

Search Aggregation Engine
MIT License
6 stars 2 forks source link

Issue 475: Alternate approach to sorting, using backend. #517

Closed kaladay closed 1 year ago

kaladay commented 1 year ago

Description

Change sort to use the backend sorting.

The Discover View Unique Identifier Key is using a weaver field. The orderBy filter is not easily added to it (appears to require a weaver change). To avoid that, sorting to the backend is implemented.

The sorting is removed from the UI in certain places. This has the benefit of the specially added all_fields on appearing at the top again.

The internal metadatum is sorted by id. If gloss is intended for the user to use, then should this not be sorted by gloss? It may be that the sorting by field is explicitly desired in this case. The backend is changed to sort by gloss to fix the Unique Identifier Key situation and so this would either need to be sorted via the UI or a new endpoint (or parameter) would be needed on the backend.

The field mappings are also now sorted by the gloss. Is this desired? It makes little sense to sort the field mappings by the field if this is a list of gloss (doesn't always have field names). In the future we may want a sort by required as the alphabetic sorts required fields like id to somewhere in the middle. Or we may want to put the important and well known fields at the top.

A comparitor is used for the solr core to perform sorting in the backend.

The angularjs sorting acts differently than the Java sorting method. Java uses natural sorting.

Consider:

Java Sort:

AngularJS Sort:

When java sorting is in place, updates on the menu drop to the bottom. A page refresh triggers proper sorting. Adding both Java sorting and AngularJS sorting handles both cases (but we get stuck with AngularJS' sorting algorithm).

Fixes #475

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist:

coveralls commented 1 year ago

Coverage Status

Coverage: 45.273% (-0.04%) from 45.314% when pulling df527ef2665442b0cb7a2b618db660d4da116de9 on 475-alphabetically_sort into 8f2dea8b195b8b270040469e48078130ab982406 on staging.