project-lux / lux-marklogic

Code, issues, and resources related to LUX MarkLogic
Other
3 stars 2 forks source link

Update how ML handles dates (fixes date sorting) #256

Closed clarkepeterf closed 2 months ago

clarkepeterf commented 4 months ago

Problem Description: Date facets sort in the wrong order because they are sorted as strings. Strings require more conversion to/from epoch times in both ML and the frontend.

Example of bad sorting Expected Behavior/Solution: Dates are sorted in the correct order

Marklogic will continue to return dates in string format. Full ISO String for years [-9999:9999]. Just the year outside of that range.

Agreed to the following on 2024-08-14: - MarkLogic will return date facets as epoch dates in seconds before/after 1970-01-01 - MarkLogic will require date search fields to use seconds before/after 1970-01-01 - Frontend will support full dates in the years -9999 - 9999 - Frontend will support just years outside of the range -9999 - 9999

Requirements: List of details required for the completion of the issue or requirements for the feature/bug. This can also include requirements that lie outside of the teams such as new design docs or clarification from an outside source.

Needed for promotion: If an item on the list is not needed, it should be crossed off but not removed.

UAT/LUX Examples:

Dependencies/Blocks: N/A

Related Github Issues: N/A

Related links: N/A

Wireframe/Mockup: Place wireframe/mockup for the proposed solution at end of ticket.

brent-hartwig commented 4 months ago

@clarkepeterf, consider naming the endpoint more generic (/range) and initially only supporting date indexes. Consumer to specify the same name parameter value as the /facets endpoint. Later on, this may expand into providing the range of other indexes, numeric or otherwise.

clarkepeterf commented 3 months ago

DIscussed with @kamerynB - we will continue with just using the /facets endpoint, no /range endpoint. The range can be achieved using two parallel facet requests for sort=asc&page=1&pageLength=1 and sort=desc&page=1&pageLength=1.

Date facets will switch to return epoch (float) times instead of the string dates

clarkepeterf commented 3 months ago

@kamerynB is it easier for you to pass in the epoch time when using search fields? If so, I can set it up to work that way. Let me know.

clarkepeterf commented 3 months ago

@roamye this will have to be done next sprint, as it needs to be made in line with https://github.com/project-lux/lux-frontend/issues/340

roamye commented 3 months ago

@clarkepeterf - this also skipped the UAT process so that work out! moving it back to prioritization review.

clarkepeterf commented 3 months ago

@roamye ok - I already have changes related to this issue pushed to DEV

roamye commented 3 months ago

From ITS Team Meeting 8/23: It would be easier for ML to pass ISO Strings. This will work for the FE as the FE will also pass the ISO strings into ML.

There is a challenge with preceding extra 0's. Which @kamerynB will look into. This could potentially be affected by dinosaur dates. Need input from @azaroth42

From TF meeting 8/26: This was moved to backlog as it now has UAT examples.

roamye commented 2 months ago

Approved by UAT 9/12

roamye commented 2 months ago

Looks good in prod. Closing.