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

Index sortable work title field in solr #6697

Merged
merged 4 commits into from
Jun 29, 2022

Conversation

mheiman
Copy link
Collaborator

@mheiman mheiman commented Jun 28, 2022

Closes #201

Adds title sorting functionality to author and search pages.

Technical

  • Modifies managed_schema to:
    • create a new field type, text_title_sortable, that optimizes text for title sorting by trimming white space, lowercasing, and moving initial articles (multi-language) to the end of the string.
    • add a new field, title_sortable of the type text_title_sortable.
  • Modifies update_work to populate the new field
  • Updates the result sorting interface to use the new field
  • Makes the sort field value sticky between searches

The manage_schema type definition includes handling for initial articles from a variety of common languages (English, Spanish, French, German, Italian) but could be expanded to include additional languages.

Source: https://www.loc.gov/marc/bibliographic/bdapndxf.html

Testing

This will require a SOLR reindex to work. After that, the Alphabetical sort option should function correctly on author and search pages.

Stakeholders

@mheiman @cdrini

Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This looks great, @mheiman !

I think the only blocker to merging is making sure we wrap things with if get_solr_next() so that we won't show title sorting option until a full re-index is performed. This is a little annoying, since a lot of the variables aren't available at the right time! It might be easier to add a new variable, title_sort_solr to the openlibrary.yml features section, and then check for that instead.

conf/solr/conf/managed-schema Outdated Show resolved Hide resolved
openlibrary/plugins/worksearch/code.py Outdated Show resolved Hide resolved
openlibrary/solr/update_work.py Outdated Show resolved Hide resolved
conf/solr/conf/managed-schema Show resolved Hide resolved
@cdrini cdrini self-assigned this Jun 28, 2022
@cdrini cdrini changed the title 201/feature/author work sort Index sortable work field in solr Jun 28, 2022
@cdrini cdrini changed the title Index sortable work field in solr Index sortable work title field in solr Jun 28, 2022
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! Not testing; saw Mark's demo and it looked good! He also confirmed it was working with copyField

@cdrini cdrini force-pushed the 201/feature/author_work_sort branch from 0a46b38 to 7959716 Compare June 29, 2022 18:46
@cdrini cdrini merged commit a3ccdb3 into internetarchive:master Jun 29, 2022
@cdrini cdrini mentioned this pull request Jul 18, 2022
8 tasks
@cdrini cdrini mentioned this pull request Aug 18, 2022
5 tasks
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.

Add "sort alphabetically" to list of Works of an Author
2 participants