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

Search parent metadata instead of no match found #234

Merged
merged 2 commits into from
May 9, 2023

Conversation

kirkkwang
Copy link
Contributor

@kirkkwang kirkkwang commented May 4, 2023

ref: notch8/essi#23, notch8/essi#24

This commit will override BlacklightIiifSearch::IiifSearch#solr_params to include the parent metadata fields in a UV search.

image

This commit will override `BlacklightIiifSearch::IiifSearch#solr_params`
to include the parent metadata fields in a UV search.
@kirkkwang kirkkwang changed the title Override BlacklightIiifSearch::IiifSearch Search parent metadata instead of no match found May 6, 2023
return { q: 'nil:nil' } unless q

{
q: "#{q} AND (#{iiif_config[:object_relation_field]}:\"#{parent_document.id}\" OR id:\"#{parent_document.id}\")",
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if we don't have a parent_document? What happens if iiif_config doesn't have the key :object_relation_field or if iiif_config[:object_relation_field] is nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems like not having a parent_document should never happen because the work itself comes in as its own parent even when looking at a work that has no parent/child relationships.

if iiif_config lost its :object_relation_field or if iiif_config[:object_relation_field] is nil, then most likely someone altered the code from the generator. I think maybe we need to raise an error at that point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried commenting out the :object_relation_field and it does not cause a crash. This however seems like a programmer if the :object_relation_field is missing (since it comes in through the generator). I'm rethinking if we need to raise an error just to account for this scenario.

@kirkkwang kirkkwang requested a review from jeremyf May 9, 2023 15:24
@kirkkwang kirkkwang merged commit d6cafaa into main May 9, 2023
@kirkkwang kirkkwang deleted the uv-parent-metadata-search branch May 9, 2023 16:00
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.

2 participants