[Evergreen-dev] Struggling with title sorting
Elaine Hardy
ehardy at georgialibraries.org
Fri Feb 3 14:15:32 EST 2023
The nonfiling indicators are correct : "Diacritical marks or special
characters at the beginning of a title field that does not begin with an
initial article are not counted as nonfiling characters." (
https://www.oclc.org/bibformats/en/2xx/245.html)
Is a space added before any coding for diacritics in an mvr record? Or is
the space in the MARC bib record?
J. Elaine Hardy, PINES and Collaborative Projects Manager
------------------------------
Georgia Public Library Service
2872 Woodcock Blvd., Suite 250 | Atlanta, GA 30341
(404) 235-7128 | ehardy at georgialibraries.org
(404) 548-4241 | Cell
<https://www.facebook.com/georgialibraries>
<https://www.twitter.com/georgialibs>
<https://www.instagram.com/georgialibraries/>
Join our email list <http://georgialibraries.org/subscription> for stories
of Georgia libraries making an impact in our communities.
It does not do to leave a live dragon out of your calculations, if you live
near him. *— J.R.R. Tolkien*
On Fri, Feb 3, 2023 at 1:37 PM Jeff Davis via Evergreen-dev <
evergreen-dev at list.evergreen-ils.org> wrote:
> Hi Ken,
>
> I'm not very familiar with title sorting. That said, it looks to me like
> the code in misc_util.tt2 is only used for sorting the user's circs, holds,
> and circ history in My Account. Search results appear to be sorted as part
> of the actual search query - that is, selecting "Title: A to Z" as your
> sort option adds a "sort(titlesort)" parameter to your search query and
> then re-runs the search. The easiest option would probably be to let the
> underlying Evergreen search sort the results for you in this way.
>
> I believe the titlesort parameter ends up sorting on the value in the
> metabib.record_sorter table for each record in your results. I'm not sure
> exactly how metabib.record_sorter values are generated when records are
> ingested (there's some deep magic involving record attributes); at a
> minimum, it looks like it takes MARC non-filing characters into account and
> also strips punctuation.
>
> It seems to me that there are a few cataloguing errors in your examples.
> There should be no space after the apostrophe in "L'événement" and the
> non-filing indicator should be "2". For the Sue Grafton books, I think the
> non-filing indicator should be "1" since the initial character (") is
> non-filing. But you should definitely verify that stuff with an actual
> cataloguer. 🙂
>
> Hopefully some of the above is useful and at least vaguely accurate!
>
> Jeff
> ------------------------------
> *From:* Evergreen-dev <evergreen-dev-bounces at list.evergreen-ils.org> on
> behalf of Ken Cox via Evergreen-dev <evergreen-dev at list.evergreen-ils.org>
> *Sent:* Saturday, January 28, 2023 7:07 PM
> *To:* evergreen-dev at list.evergreen-ils.org <
> evergreen-dev at list.evergreen-ils.org>
> *Subject:* [Evergreen-dev] Struggling with title sorting
>
> I am struggling to sort lists by title in the mobile app. Can somebody
> point me to the code where it happens, or explain how it's supposed to
> happen?
>
> I found code in misc_utils.tt2
> <https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/templates/opac/parts/misc_util.tt2;h=283bcb098c37f58337cffc5ec4a60c7403e154cd;hb=HEAD#l275>,
> and read up on MARC 245 ind2 non-filing characters, hooray! I implemented
> the logic and it doesn't match the OPAC, boo!
>
> *Is this the right code in misc_utils.tt2
> <https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/templates/opac/parts/misc_util.tt2;h=283bcb098c37f58337cffc5ec4a60c7403e154cd;hb=HEAD#l275>
> ?*
>
> 275 # If the title has a "non-filing chaaracters"
> 276 # (to logically remove leading "The " for example)
> 277 # chop the title. Otherwise, chop until the first
> alphanumeric.
> 278 # BTW: Template Toolkit folds 1-element arrays to scalars!
> 279 title_node = xml.findnodes('//*[@tag="245"]');
> 280
> 281 args.nonfiling_characters = title_node.findvalue('@ind2');
> 282
> 283 IF (args.nonfiling_characters > 0);
> 284 args.sort_title =
> args.sort_title.substr(args.nonfiling_characters);
> 285 ELSE;
> 286 args.sort_title =
> args.sort_title.replace('^[^A-Z0-9]*','');
> 287 END;
>
>
> *small example*
>
> My public list
> <https://catalog.cwmars.org/eg/opac/results?query=&qtype=keyword&fi%3Asearch_format=&locg=1&detail_record_view=0&bookbag=1952592&sort=titlesort&depth=0> in
> the OPAC sorted by Title looks like this:
>
> 1. "E" is for evidence
> 2. L'événement = Happening
> 3. "G" is for gumshoe
>
> That looks right. Logging from the app show why this sort is wrong:
>
> item 4692942 has 2 non-filing chars: "L' événement = : Happening" -> "
> ÉVÉNEMENT = : HAPPENING"
> item 3152814 has 0 non-filing chars: ""E" is for evidence" -> "E" IS FOR
> EVIDENCE"
> item 3176781 has 0 non-filing chars: ""G" is for gumshoe" -> "G" IS FOR
> GUMSHOE"
>
> The first item has a space after L' in the mvr record
> <https://catalog.cwmars.org/osrf-gateway-v1?service=open-ils.search&method=open-ils.search.biblio.record.mods_slim.retrieve¶m=4692942&_ck=114&_sk=3-7-3>,
> and so skipping 2 chars sorts on the space. Maybe this is an encoding
> issue in the OSRF gateway?
>
> Thanks for listening!
> --
> Ken
> This message originated from outside the M365 organisation. Please be
> careful with links, and don't trust messages you don't recognise.
> _______________________________________________
> Evergreen-dev mailing list
> Evergreen-dev at list.evergreen-ils.org
> http://list.evergreen-ils.org/cgi-bin/mailman/listinfo/evergreen-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.evergreen-ils.org/pipermail/evergreen-dev/attachments/20230203/5eb25e48/attachment-0001.htm>
More information about the Evergreen-dev
mailing list