Class: Blacklight::SearchState::PivotFilterField::QueryBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/blacklight/search_state/pivot_filter_field.rb

Class Method Summary collapse

Class Method Details

.call(search_builder, filter, solr_parameters) ⇒ Array

Returns filter_query, subqueries.

Returns:

  • (Array)

    filter_query, subqueries



94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/blacklight/search_state/pivot_filter_field.rb', line 94

def self.call(search_builder, filter, solr_parameters)
  existing = solr_parameters['fq']&.dup || []
  queries = []
  filter.values.compact_blank.each do |value|
    queries << search_builder.send(:facet_value_to_fq_string, filter.pivot.first, value.value)
    value.fq.each do |entry|
      k, v = entry
      queries << search_builder.send(:facet_value_to_fq_string, k, v) if v
    end
    queries.uniq!
  end
  [(queries - existing)]
end