Class: Sunspot::Query::Restriction::EqualTo

Inherits:
Base
  • Object
show all
Defined in:
sunspot/lib/sunspot/query/restriction.rb

Overview

Results must have field with value equal to given value. If the value is nil, results must have no value for the given field.

Constant Summary

Constants inherited from Base

RESERVED_WORDS

Instance Method Summary (collapse)

Methods inherited from Base

#initialize, #negate, #to_boolean_phrase, #to_negated_boolean_phrase, #to_params

Methods included from Filter

#tag, #to_filter_query

Constructor Details

This class inherits a constructor from Sunspot::Query::Restriction::Base

Instance Method Details

- (Boolean) negated?

Returns:

  • (Boolean)


160
161
162
163
164
165
166
# File 'sunspot/lib/sunspot/query/restriction.rb', line 160

def negated?
  if @value.nil?
    !super
  else
    super
  end
end

- (Object) to_positive_boolean_phrase



152
153
154
155
156
157
158
# File 'sunspot/lib/sunspot/query/restriction.rb', line 152

def to_positive_boolean_phrase
  unless @value.nil?
    super
  else
    "#{escape(@field.indexed_name)}:[* TO *]"
  end
end