Title A-Z / Z-A sort option not working on collections
Descriptive summary
On a Collection "View All" page, the sort options for Title A-Z and Title Z-A are not producing correctly ordered results.
Choosing a Title sort option does change the sort order from the default order, but the resulting ordering isn't alphabetical (not immediately obvious what it is using instead). Also Z-A and A-Z results are in the same order.
This was first reported in the rockyshore93 collection but is showing up elsewhere too. General All Fields search results from the front page and main search bar seem to be properly sortable by title. Collection sorting seems to be working as expected on Staging.
Expected behavior
Choosing to sort results by Title will order results alphabetically by title.
Related work
https://github.com/OregonDigital/OD2/issues/1652
Accessibility Concerns
On a quick look, calling work.update_index apparently does not produce the title_ssort field value in the solr document. The works I checked in rockyshore93 don't have a value set there, so there's nothing to sort on.
# w.update_index / sd = SolrDocument.find(w.id)
irb(main):089:0> sd['title_ssort']
=> nil
irb(main):090:0> sd['date_dtsi']
=> "1993-05-09T00:00:00Z"
Calling work.to_solr and .generate_solr_document from the Indexer does generate these, though the date field for sort has an incorrect format. And those don't directly save, just give the indexing output.
# w.to_solr
# ii = ImageIndexer(w) / ii.generate_solr_document
"title_ssort"=>"port orford humbug mountain",
"date_dtsi"=>Sun, 09 May 1993 00:00:00 +0000,
update to this issue: after updating the metadata records for all Works in rockyshore93 today, now when the Title A-Z sort is applied to the updated Works, they appear to be sorting in the correct A-Z order. https://oregondigital.org/catalog?f%5Bnon_user_collections_ssim%5D%5B%5D=rockyshore93&locale=en&page=1&per_page=20&sort=title_ssort+asc
However, the Sort problem is still happening in other Collections, such as Braceros: https://oregondigital.org/catalog?f%5Bnon_user_collections_ssim%5D%5B%5D=braceros&locale=en&sort=title_ssort+asc
So it looks like when the rockyshore93 Works were reindexed during the metadata update, that resolved this issue for these Works only?
info about the rockyshore93 Works updated today:
- I updated all 300 Works in rockyshore93 via Bulkrax. I ran the updates in 2 separate Importers:
- small test set: https://oregondigital.org/importers/3228?locale=en
- rest of Works in the Collection: https://oregondigital.org/importers/3231?locale=en
unrelated - the 2nd importer completed with system errors, so I re-ran it a couple times. I'm putting info about the errors in a separate ticket: https://github.com/osulp/metadata/issues/321.
Braceros looks good after a reindex: https://oregondigital.org/catalog?f%5Bnon_user_collections_ssim%5D%5B%5D=braceros&locale=en&page=1&sort=title_ssort+asc
Rockyshore93 sort still looks good: https://oregondigital.org/catalog?f%5Bnon_user_collections_ssim%5D%5B%5D=rockyshore93&locale=en&page=1&sort=title_ssort+asc