Class: Sunspot::Query::FunctionalFunctionQuery

Inherits:
FunctionQuery show all
Defined in:
lib/sunspot/query/function_query.rb

Overview

Function query which represents an actual function invocation. Takes a function name and arguments as parameters. Arguments are in turn FunctionQuery objects.

Instance Attribute Summary collapse

Attributes inherited from FunctionQuery

#boost_amount

Instance Method Summary collapse

Methods inherited from FunctionQuery

#^

Constructor Details

#initialize(function_name, function_args) ⇒ FunctionalFunctionQuery

Returns a new instance of FunctionalFunctionQuery.



65
66
67
# File 'lib/sunspot/query/function_query.rb', line 65

def initialize(function_name, function_args)
  @function_name, @function_args = function_name, function_args
end

Instance Attribute Details

#function_argsObject (readonly)

Returns the value of attribute function_args.



63
64
65
# File 'lib/sunspot/query/function_query.rb', line 63

def function_args
  @function_args
end

#function_nameObject (readonly)

Returns the value of attribute function_name.



63
64
65
# File 'lib/sunspot/query/function_query.rb', line 63

def function_name
  @function_name
end

Instance Method Details

#==(other) ⇒ Object



74
75
76
77
# File 'lib/sunspot/query/function_query.rb', line 74

def ==(other)
  super and
    @function_name == other.function_name and @function_args == other.function_args
end

#to_sObject



69
70
71
72
# File 'lib/sunspot/query/function_query.rb', line 69

def to_s
  params = @function_args.map { |arg| arg.to_s }.join(",")
  "#{@function_name}(#{params})" << (@boost_amount ? "^#{@boost_amount}" : "")
end