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

update bce calculation #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

update bce calculation #148

wants to merge 1 commit into from

Conversation

dnoneill
Copy link

@dnoneill dnoneill commented Feb 13, 2024

closes sul-dlss/searchworks_traject_indexer#1319

This addresses that in order to be able to sort dates bce dates (https://searchworks.stanford.edu/view/qb122dq4313.json) with dates like 19xx 195x the date gets converted to a string. When sorting a negative string i.e. "-1" = 1 BCE, "-2" = BCE these would get sorted -1,-2 when they should get sorted -2, -1. See

# return a single string intended for lexical sorting for pub date
# prefer dateIssued (any) before dateCreated (any) before dateCaptured (any)
# look for a keyDate and use it if there is one; otherwise pick earliest date
# @param [Boolean] ignore_approximate true if approximate dates (per qualifier attribute) should be ignored; false if approximate dates should be included
# @return [String] single String containing publication year for lexical sorting
# @note for string sorting 5 BCE = -5 => -995; 6 BCE => -994, so 6 BCE sorts before 5 BCE
# @deprecated use pub_year_int
for more information about this sorting.

The current branch subtracts -1000 from the absolute value (i.e. 1-1000 = -999). This is a problem for larger BCE dates which return 6000 and not a negative number. The fix is to increase this number.

@hudajkhan
Copy link

Please provide a little more context (perhaps a before/after comparison). thanks

@dnoneill
Copy link
Author

dnoneill commented Jan 7, 2025

@hudajkhan I am not quite sure what more context you would like. Could you give me an example? The description includes examples.

@hudajkhan
Copy link

@dnoneill reading it over again, I'm not sure what it was I meant by the comment. I'll look over the details again and ask if I have any questions, but I think you are correct that the necessary information is included in the issue.

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.

Bad pub_date_sort for some really old objects from SDR
2 participants