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-1342 Modernize browse indexer #48

Merged
merged 12 commits into from
Dec 12, 2023
Merged

VUFIND-1342 Modernize browse indexer #48

merged 12 commits into from
Dec 12, 2023

Conversation

marktriggs
Copy link
Collaborator

@marktriggs marktriggs commented Dec 8, 2023

This PR addresses the issues described here:

https://openlibraryfoundation.atlassian.net/browse/VUFIND-1342

I've finished my first pass across everything, and thought I'd get a PR up to invite feedback. The story so far:

  • The unqualified classes used for indexing are now in the org.vufind.solr.indexing package

  • The word "leech" has been replaced with "FieldIterator" in the places it appeared

  • All FieldIterators are autoclosable, and we take advantage of that where possible

  • Cleaned up imports (expanded wildcards and removed unused imports)

To preserve compatibility with existing usage, there are wrapper versions of CreateBrowseSQLite and PrintBrowseHeadings under a compat directory that log deprecation warnings and then pass through to the new versions. There's also code to detect usage of old environment variables and system properties (BIBLEECH) and old versions of class names. All of this code can probably be thrown out in a future release, once people have had time to update their scripts.

Besides that, tests are all still passing, and I have a corresponding PR against VuFind to update the index-alphabetic-browse scripts to use the new names. I'll link to this PR from there once I send it.

TODO

  • When merging, open JIRA ticket to track task to remove deprecated code in next major release.

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, this looks great! The test suite is passing, so I've gone ahead and pushed the binaries into vufind-org/vufind#3253 so it is ready to merge when this is finished. (And of course I'll update them if other feedback leads to changes in the meantime... but since I had to put them there to test, I figured I might as well commit in case it saves us time in future).

See below for one tiny documentation suggestion, and an observation of no great importance.

README.md Outdated Show resolved Hide resolved
@demiankatz demiankatz requested a review from todolson December 8, 2023 20:38
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'm approving this, but I'll hold off on merging it for a few days in case @todolson or others have any additional comments.

Copy link

@todolson todolson left a comment

Choose a reason for hiding this comment

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

I have not fully (re?)digested PrintBrowseHeadings.java, but so far I do think this all looks good. I see no reason to stand in the way.

Thank you, @marktriggs, for taking on this overdue modernization!

Copy link

@todolson todolson left a comment

Choose a reason for hiding this comment

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

A couple items that I didn't catch on Friday. These comments are not meant to derail a commit.

/**
* Load headings from the index into a file.
*
* @param fieldIterator Leech for pulling in headings

Choose a reason for hiding this comment

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

Late comment: would be good to change this parameter description, since the Leech classes have all been renamed. Maybe something like:
"Iterator for pulling in headings from Solr matches"

throws Exception
{
BrowseEntry h;
while ((h = fieldIterator.next()) != null) {

Choose a reason for hiding this comment

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

This is probably out of scope for the current effort, but this makes me wonder if SolrFieldIterator should implement the Iterator interface sometime in the future. It already has a next() method, so it's mostly there.

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.

I agree with @todolson that it's probably a good idea to change the comment(s) that use the word "Leech" for consistency, but more substantive changes can be addressed separately. Do you mind making the edit, @marktriggs, or would you like me to take care of it for you?

@marktriggs
Copy link
Collaborator Author

I agree with @todolson that it's probably a good idea to change the comment(s) that use the word "Leech" for consistency, but more substantive changes can be addressed separately. Do you mind making the edit, @marktriggs, or would you like me to take care of it for you?

I can pick that up since I'm still set up for testing, thanks for the review @todolson. I'll look at adding the Iterator interface too; might as well :)

@demiankatz
Copy link
Member

Thanks! I'll wait for this to get finished before I take on #49, though it looks like that's going to be an easy one to merge. :-)

@marktriggs
Copy link
Collaborator Author

@demiankatz @todolson I think that's ready to go now. I ended up implementing both Iterator and Iterable, since the latter is an easy addition and it neatens up the loop over headings a little.

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 now, and all tests still pass.

@demiankatz demiankatz merged commit b34f607 into dev Dec 12, 2023
2 checks passed
@demiankatz demiankatz deleted the VUFIND-1342 branch December 12, 2023 13:29
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.

3 participants