Module: Geoblacklight::SuppressedRecordsSearchBehavior

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb

Instance Method Summary collapse

Instance Method Details

#hide_suppressed_records(solr_params) ⇒ Blacklight::Solr::Request

Hide suppressed records in search

Parameters:

  • (Blacklight::Solr::Request)

Returns:

  • (Blacklight::Solr::Request)


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb', line 15

def hide_suppressed_records(solr_params)
  # Show suppressed records when searching relationships
  return if blacklight_params.fetch(:f,
    {}).keys.any? do |field|
              Settings.RELATIONSHIPS_SHOWN.map do |_key, value|
                value.field
              end.include?(field)
            end

  # Do not suppress action_documents method calls for individual documents
  # ex. CatalogController#web_services (exportable views)
  return if solr_params[:q]&.include?("{!lucene}#{Settings.FIELDS.ID}:")

  solr_params[:fq] ||= []
  solr_params[:fq] << "-#{Settings.FIELDS.SUPPRESSED}: true"
end