Sha256: 5d9c198c1964727cc922b647ea89d1e0af24aaa03e18e08c69c1e18d433a7d34

Contents?: true

Size: 758 Bytes

Versions: 44

Compression:

Stored size: 758 Bytes

Contents

module Sunspot
  module DSL
    class Function #:nodoc:
      def initialize(functional) #:nodoc:
        @functional = functional
      end

      # Special case to handle <http://wiki.apache.org/solr/FunctionQuery#sub>
      # because `Kernel#sub` exists so `method_missing` will not be called
      # for this function.
      def sub(*args) #:nodoc:
        create_function_query(:sub, *args)
      end

      def method_missing(method, *args, &block)
        create_function_query(method, *args)
      end

      private

      def create_function_query(method, *args)
        function_args = args.map { |arg| @functional.create_function_query(arg) }
        Sunspot::Query::FunctionalFunctionQuery.new(method, function_args)
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 7 rubygems

Version Path
gojee-sunspot-2.0.5 lib/sunspot/dsl/function.rb
sunspot-2.0.0.pre.120925 lib/sunspot/dsl/function.rb
sunspot_solr-2.0.0.pre.120924 sunspot/lib/sunspot/dsl/function.rb
sunspot_rails-2.0.0.pre.120924 sunspot/lib/sunspot/dsl/function.rb
sunspot-2.0.0.pre.120924 sunspot/lib/sunspot/dsl/function.rb
gojee-sunspot-2.0.4 lib/sunspot/dsl/function.rb
gojee-sunspot-2.0.2 lib/sunspot/dsl/function.rb
sunspot-2.0.0.pre.120720 lib/sunspot/dsl/function.rb
sunspot-1.3.3 lib/sunspot/dsl/function.rb
sunspot-1.3.2 lib/sunspot/dsl/function.rb
sunspot-2.0.0.pre.120417 lib/sunspot/dsl/function.rb
sunspot-2.0.0.pre.120415 lib/sunspot/dsl/function.rb
sunspot-1.3.1 lib/sunspot/dsl/function.rb
erichummel-sunspot-2.0.0.pre.111215d lib/sunspot/dsl/function.rb
erichummel-sunspot-2.0.0.pre.111215c lib/sunspot/dsl/function.rb
erichummel-sunspot-2.0.0.pre.111215b lib/sunspot/dsl/function.rb
erichummel-sunspot-2.0.0.pre.111215a lib/sunspot/dsl/function.rb
erichummel-sunspot-2.0.0.pre.111215 lib/sunspot/dsl/function.rb
sunspot-2.0.0.pre.111215 lib/sunspot/dsl/function.rb
cb_sunspot-2.0.0.pre.5 lib/sunspot/dsl/function.rb