-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎁 Add
AllinsonFlex
fields to solr queries
If `AllinsonFlex` is defined in an application, this commit will add the ability to add `AllinsonFlex` fields to the the catalog search and IIIF search.
- Loading branch information
Showing
4 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
app/search_builders/concerns/iiif_print/allinson_flex_fields.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module IiifPrint | ||
module AllinsonFlexFields | ||
def include_allinson_flex_fields(solr_parameters) | ||
return unless defined?(AllinsonFlex) | ||
|
||
solr_parameters[:qf] += IiifPrint.allinson_flex_fields | ||
.each_with_object([]) do |field, arr| | ||
arr << (field.name + '_tesim') if field.is_a?(AllinsonFlex::ProfileProperty) | ||
end | ||
.join(' ') | ||
end | ||
end | ||
end |
11 changes: 11 additions & 0 deletions
11
app/search_builders/concerns/iiif_print/iiif_search_builder_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
# OVERRIDE BlacklightIiifSearch v1.0.0 to include AllinsonFlex fields in the search | ||
|
||
module IiifPrint | ||
module IiifSearchBuilderDecorator | ||
# NOTE: ::IiifSearchBuilder.default_processor_chain += [:include_allinson_flex_fields] | ||
# is on the engine.rb file so this decorator is loaded before the `default_processor_chain` is set. | ||
include IiifPrint::AllinsonFlexFields | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters