Sha256: 4f2b395beb4fe77557caa64109b9723422983130d5b9ed61cb4624875e4c3034

Contents?: true

Size: 569 Bytes

Versions: 3

Compression:

Stored size: 569 Bytes

Contents

module NewspaperWorks
  # hide Title, Container, and Issue objects if this is a keyword search
  # can be added to default_processor_chain in a SearchBuilder class
  module ExcludeModels
    extend ActiveSupport::Concern

    def exclude_models(solr_parameters)
      return unless solr_parameters[:q] || solr_parameters[:all_fields]
      type_field = 'human_readable_type_sim'
      solr_parameters[:fq] ||= []
      %w[Title Container Issue].each do |model|
        solr_parameters[:fq] << '-' + type_field + ':"Newspaper ' + model + '"'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newspaper_works-1.0.1 app/search_builders/concerns/newspaper_works/exclude_models.rb
newspaper_works-1.0.0 app/search_builders/concerns/newspaper_works/exclude_models.rb
newspaper_works-0.1.0 app/search_builders/concerns/newspaper_works/exclude_models.rb