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

VUFIND-1710 Add configurable separators for topics in alphabrowse #4011

Merged

Conversation

marktriggs
Copy link
Contributor

@marktriggs marktriggs commented Oct 15, 2024

Currently, subjects are shown differently between the record view in VuFind and the topic browse. In the record view you see delimiters like this:

Morris, William, > 1834-1896 > Criticism and interpretation.

But in the topic browse, the fields are just joined with spaces:

Morris, William, 1834-1896 Criticism and interpretation.

This commit:

  • Adds a UTF-8 separator to delimit terms within topics in the Solr index

  • Adjusts the topic_browse definition to use a new TopicNormalizer, which strips out these new delimiters when building the sort key.

  • Changes the frontend of the AlphaBrowse to insert a user-configurable delimiter, shown when browsing topics.

Note: since Normalizer classes currently live in the vufind-browse-handler, there will be a corresponding commit there to add TopicNormalizer.

TODO

  • Document Solr schema change when merging
  • Resolve VUFIND-1710 when merging

Currently, subjects are shown differently between the record view in
VuFind and the topic browse.  In the record view you see delimiters
like this:

    Morris, William, > 1834-1896 > Criticism and interpretation.

But in the topic browse, the fields are just joined with spaces:

    Morris, William, 1834-1896 Criticism and interpretation.

This commit:

  * Adds a UTF-8 separator to delimit terms within topics in the Solr
    index

  * Adjusts the topic_browse definition to use a new TopicNormalizer,
    which strips out these new delimiters when building the sort key.

  * Changes the frontend of the AlphaBrowse to insert a
    user-configurable delimiter, shown when browsing topics.

Note: since Normalizer classes currently live in the
vufind-browse-handler, there will be a corresponding commit there to
add TopicNormalizer.
@marktriggs
Copy link
Contributor Author

@demiankatz @dltj Just sending the pull request for VUFIND-1710 to get the review rolling :)

Note that there's also a vufind-browse-handler PR to go with this one: vufind-org/vufind-browse-handler#51. I wasn't sure how best to handle the bundled browse-indexing.jar and browse-handler.jar files, so I've left them out of this PR for now.

@demiankatz
Copy link
Member

@demiankatz @dltj Just sending the pull request for VUFIND-1710 to get the review rolling :)

Note that there's also a vufind-browse-handler PR to go with this one: vufind-org/vufind-browse-handler#51. I wasn't sure how best to handle the bundled browse-indexing.jar and browse-handler.jar files, so I've left them out of this PR for now.

Thanks, @marktriggs! vufind-org/vufind-browse-handler#51 looks reasonable to me, so I've gone ahead and merged it. That way, you can now build the .jar artifacts and add them to this PR so that we can test the whole thing together.

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

Here are a few comments from an initial review; I'll do more hands-on and automated testing once the .jar files have been added.

I'm also going to pin this to the 11.0 release, since 10.1 is very close and I don't want to introduce last-minute Solr schema changes.

config/vufind/config.ini Outdated Show resolved Hide resolved
config/vufind/config.ini Outdated Show resolved Hide resolved
@demiankatz demiankatz added this to the 11.0 milestone Oct 15, 2024
Built from commit 25863e56d0fd4b02deedbfd72aca7a5c4885bdd7 in vufind-org/vufind-browse-handler
@marktriggs
Copy link
Contributor Author

Thanks @demiankatz,

I've applied the changes from your first review, and have checked in the updated jar files too. Do you have a quick way of testing on Windows? The .bat file changes are pretty trivial, but I'd feel better seeing them working. I can try getting things running on a Windows machine here if you don't have one handy.

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

Thanks, @marktriggs. I can try to test this out in Windows soon -- just having a busy week and haven't gotten that far yet.

In the meantime, see below for a tiny style suggestion.

Also, did you notice that tests are failing in PHP 8.3? Please let me know if you need any help investigating/sorting that out.

config/vufind/config.ini Outdated Show resolved Hide resolved
The modified AlphaBrowse now makes use of sort_key, which is returned
by the browse handler.  This is basically the heading as stored in the
Solr index, as opposed to the 'heading' key which will have been
manipulated for display in some cases (such as Topic browse)
@marktriggs
Copy link
Contributor Author

Thanks @demiankatz, and no rush from me.

I've fixed the comment syntax and figured out why that test was failing. The AlphaBrowse code returns items with keys heading and sort_key, but the test code was mocking items and only including heading.

Historically that didn't matter because the browse frontend only used heading anyway. There are two ways that the browse heading is used: the point where we show the heading to the user, and the point that we build a query link (with a lookfor parameter) to view the associated record(s). Up until now, the heading shown to the user was identical to the value stored in the Solr index, so there was no distinction between the two cases (and that's why just using heading exclusively was fine).

But now we're rewriting the delimiter in topics, what we display to the user isn't the same as what's in the index. So, heading is the label shown to the user, while sort_key is the index value needed for constructing a matching lookfor query.

@demiankatz
Copy link
Member

@marktriggs, I was able to confirm that this works correctly in Windows. I tested the dev branch: no separators; I switched to this branch and rebuilt the index: separators appeared!

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

This looks good to me, and all tests are passing in my local environment. I'll just leave this open a little longer in case @dltj or others have any last-minute suggestions or concerns.

@dltj
Copy link
Contributor

dltj commented Oct 21, 2024

I'm good-to-go with this. Thanks, Mark and Demian!

@demiankatz demiankatz changed the base branch from dev to dev-11.0 October 21, 2024 17:31
@demiankatz demiankatz merged commit 951f74b into vufind-org:dev-11.0 Oct 21, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants