There is a fixme in the code related to this. For dates like the 260c and 264c we need a way to parse p2014 into 2014 etc. This affects sorting on dates
If sort by publication date is not working, it should probably not be an option. It is a nice option so it would be good to have fixed. When results return more records than are easily reviewed it is nice to be able to sort either alphabetical by title (which is also not working) or publication date.
Created attachment 99626 [details] [review] Bug 24559: Add 'year' type to Elasticsearch When indexing fields like 260c or 008_/7-10 we need a way to format these 'date' fields into years. Removing punctuation and coverting unknown values to 0 To test: 1 - Edit some records to have dates of publication in 008 like 202u 2021 203u 2039 2 - Also add to title for all records a unique word like 'octoparrot' 3 - Search for 'octoparrot' 4 - Sort records by publication/copyrightdate 5 - Confirm sorting is not as expected 6 - Apply patch 7 - Set copydate to 'year' type 8 - Reindex 9 - Repeat search 10 - Confirm sorting works as expected
Nick, I'm getting this error when I try to change copydate to Year: An error occurred when updating mappings: DBIx::Class::Storage::DBI::_dbh_execute(): Data truncated for column 'type' at row 1 at /kohadevbox/koha/Koha/Object.pm line 156 . How do I fix that? (and how on earth did you come up with octoparrot??)
Created attachment 99785 [details] [review] Bug 24559: Database update
(In reply to Myka Kennedy Stephens from comment #3) > Nick, I'm getting this error when I try to change copydate to Year: > An error occurred when updating mappings: > DBIx::Class::Storage::DBI::_dbh_execute(): Data truncated for column 'type' > at row 1 at /kohadevbox/koha/Koha/Object.pm line 156 . > > How do I fix that? (and how on earth did you come up with octoparrot??) Hah, you need the update I didn't attach It's a Simpsons joke: https://giphy.com/gifs/season-12-the-simpsons-12x9-3orifddyIN9i0I9tp6 "polly shouldn't be"
Created attachment 99791 [details] [review] Bug 24559: Add 'year' type to Elasticsearch When indexing fields like 260c or 008_/7-10 we need a way to format these 'date' fields into years. Removing punctuation and coverting unknown values to 0 To test: 1 - Edit some records to have dates of publication in 008 like 202u 2021 203u 2039 2 - Also add to title for all records a unique word like 'octoparrot' 3 - Search for 'octoparrot' 4 - Sort records by publication/copyrightdate 5 - Confirm sorting is not as expected 6 - Apply patch 7 - Set copydate to 'year' type 8 - Reindex 9 - Repeat search 10 - Confirm sorting works as expected Nice work, Nick. Signed-off-by: Michal Denar <black23@gmail.com>
Created attachment 99792 [details] [review] Bug 24559: Database update Signed-off-by: Michal Denar <black23@gmail.com>
*** Bug 25378 has been marked as a duplicate of this bug. ***
Resolving this in favor of 24807 *** This bug has been marked as a duplicate of bug 24807 ***