Sha256: e37368a788197a16fc4d18007076d98b2a2effdd138b9fa49c32b72f33564498
Contents?: true
Size: 1.39 KB
Versions: 7
Compression:
Stored size: 1.39 KB
Contents
class Hyrax::CatalogSearchBuilder < Hyrax::SearchBuilder self.default_processor_chain += [ :add_access_controls_to_solr_params, :show_works_or_works_that_contain_files, :show_only_active_records ] # show both works that match the query and works that contain files that match the query def show_works_or_works_that_contain_files(solr_parameters) return if blacklight_params[:q].blank? || blacklight_params[:search_field] != 'all_fields' solr_parameters[:user_query] = blacklight_params[:q] solr_parameters[:q] = new_query solr_parameters[:defType] = 'lucene' end # show works that are in the active state. def show_only_active_records(solr_parameters) solr_parameters[:fq] ||= [] solr_parameters[:fq] << '-suppressed_bsi:true' end private # the {!lucene} gives us the OR syntax def new_query "{!lucene}#{interal_query(dismax_query)} #{interal_query(join_for_works_from_files)}" end # the _query_ allows for another parser (aka dismax) def interal_query(query_value) "_query_:\"#{query_value}\"" end # the {!dismax} causes the query to go against the query fields def dismax_query "{!dismax v=$user_query}" end # join from file id to work relationship solrized file_set_ids_ssim def join_for_works_from_files "{!join from=#{ActiveFedora.id_field} to=file_set_ids_ssim}#{dismax_query}" end end
Version data entries
7 entries across 7 versions & 1 rubygems