Sha256: e393feccc6fa9fbc700c81733fa695104d1aed253556d5ca2284da47ffa55b7c
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
require 'dynamic_sunspot_search/translator/boost_recency' require 'dynamic_sunspot_search/translator/facet' require 'dynamic_sunspot_search/translator/field_list' require 'dynamic_sunspot_search/translator/order_by' require 'dynamic_sunspot_search/translator/order_by_function' require 'dynamic_sunspot_search/translator/paginate' require 'dynamic_sunspot_search/translator/scope' require 'dynamic_sunspot_search/translator/text_search' module DynamicSunspotSearch module Translator def self.translate(query_object, query_hash) query = query_hash.deep_dup.deep_symbolize_keys query_object.tap do |search| TextSearch.apply(search, query.extract!(:fulltext, :all, :any)) Scope.apply(search, query.extract!(:with, :without, :any_of, :all_of, :scope)) FieldList.apply(search, query.delete(:field_list)) OrderBy.apply(search, query.delete(:order_by)) OrderByFunction.apply(search, query.delete(:order_by_function)) Paginate.apply(search, query.delete(:paginate)) Facet.apply(search, query.delete(:facet)) BoostRecency.apply(search, query.delete(:boost_recency)) raise ArgumentError.new("Unknown keys detected: #{query.keys}") unless query.blank? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dynamic_sunspot_search-0.1.4 | lib/dynamic_sunspot_search/translator.rb |
dynamic_sunspot_search-0.1.3 | lib/dynamic_sunspot_search/translator.rb |