Sha256: a2d08a319a4ee867293346adf6d9c7c142c32f5dce243d95de47c687f1fa2b14
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
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)) raise ArgumentError.new("Unknown keys detected: #{options.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.1 | lib/dynamic_sunspot_search/translator.rb |
dynamic_sunspot_search-0.1.0 | lib/dynamic_sunspot_search/translator.rb |