@@ -14,6 +14,24 @@ def link_to_facet_list(values, solr_field, empty_message = "No value entered", s
1414 safe_join ( values . map { |item | link_to_facet ( item , facet_field ) } , separator )
1515 end
1616
17+ # OVERRIDE Hyrax v5.2.0 Hyrax::HyraxHelperBehavior#index_field_link
18+ # Upstream writes the bare M3 property name (e.g. "contributor") into
19+ # the catalog URL as search_field=contributor, which targets no real
20+ # Solr field. Prefer the facet form when the index field config has a
21+ # link_to_facet set; otherwise suffix _sim onto the bare name so the
22+ # search_field= URL routes to the indexed _sim field.
23+ def index_field_link ( options )
24+ raise ArgumentError unless options [ :config ] && options [ :config ] [ :field_name ]
25+ facet_field = options [ :config ] . try ( :link_to_facet ) || options [ :config ] [ :link_to_facet ]
26+ if facet_field . present?
27+ safe_join ( options [ :value ] . map { |item | link_to_facet ( item , facet_field ) } , ", " )
28+ else
29+ name = options [ :config ] [ :field_name ] . to_s
30+ name = "#{ name } _sim" unless name . match? ( /_(sim|ssim|tesim|tsim|ssi|tsi|dtsi)\z / )
31+ safe_join ( options [ :value ] . map { |item | link_to_field ( name , item , item ) } , ", " )
32+ end
33+ end
34+
1735 # Used by the gallery view
1836 def collection_thumbnail ( _document , _image_options = { } , _url_options = { } )
1937 return super if Site . instance . default_collection_image . blank?
0 commit comments