Class: Sunspot::Query::Restriction::SameAs

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

Overview

Result must be the exact instance given (only useful when negated).

Instance Method Summary collapse

Methods inherited from Base

#to_boolean_phrase, #to_negative_boolean_phrase, #to_params

Constructor Details

#initialize(object, negative = false) ⇒ SameAs

Returns a new instance of SameAs.



212
213
214
# File 'lib/sunspot/query/restriction.rb', line 212

def initialize(object, negative = false)
  @object, @negative = object, negative
end

Instance Method Details

#to_positive_boolean_phraseObject



216
217
218
219
# File 'lib/sunspot/query/restriction.rb', line 216

def to_positive_boolean_phrase
  adapter = Adapters::InstanceAdapter.adapt(@object)
  "id:#{Solr::Util.query_parser_escape(adapter.index_id)}"
end