-
Notifications
You must be signed in to change notification settings - Fork 355
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
Improved RIS export #3954
base: dev
Are you sure you want to change the base?
Improved RIS export #3954
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @damien-git -- this looks like a significant improvement. I have a few suggested adjustments/improvements; see below.
module/VuFind/src/VuFind/RecordDriver/Feature/MarcAdvancedTrait.php
Outdated
Show resolved
Hide resolved
* | ||
* @param string $field Marc field to search within | ||
* @param array $subfield Sub-fields to return or empty for all | ||
* @param string $indNum The Marc indicator to filter for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if you replaced the $indNum and $indValue parameters with a single array of indicator filters, and then any rows that match a filter will be allowed through? This way, instead of doing array merging in some of the functions below, you could request everything at once -- e.g.
return array_merge(
$this->getMarcFieldWithInd('520', null, '1', ''),
$this->getMarcFieldWithInd('520', null, '1', '0'),
$this->getMarcFieldWithInd('520', null, '1', '2'),
$this->getMarcFieldWithInd('520', null, '1', '3'),
$this->getMarcFieldWithInd('520', null, '1', '8'),
);
becomes:
return $this->getMarcFieldWithInd('520', null, [['1' => ''], ['1' => '0'], ['1' => '2'], ['1' => '3'], ['1' => '8']]);
Of course, there are other ways you could slice this... I'm just thinking the "array of arrays" approach might be more flexible since it would allow you to specify patterns that match two indicators at once if that need should arise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you could set things up so the array could include an array of values, meaning "any of these" and that would reduce it down to:
return $this->getMarcFieldWithInd('520', null, [['1' => ['', '0', '2', '3', '8']]]);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion! I did that refactoring and added some unit tests to get SolrMarc.php back to 100% coverage.
This PR adds additional tags to the RIS export. A number of them are based on new SolrMarc functions, so they are specific to this driver.
New tags:
Updated tags:
There might be ways to improve the way this implementation works with other drivers...