Class: Workarea::Search::FacetValues

Inherits:
Object
  • Object
show all
Defined in:
app/models/workarea/search/facet_values.rb

Class Method Summary collapse

Class Method Details

.sanitize(values) ⇒ Array<String>

Clean up values to remove blanks, duplicates, and extra whitespace. Also converts all values to be strings. Used when adding product facet values into the Elasticsearch index.

Returns:



11
12
13
# File 'app/models/workarea/search/facet_values.rb', line 11

def self.sanitize(values)
  Array(values).flatten.map(&:to_s).reject(&:blank?).map(&:strip).uniq
end