Class: Sunspot::Query::Connective::Disjunction

Inherits:
Abstract
  • Object
show all
Defined in:
sunspot/lib/sunspot/query/connective.rb

Overview

Disjunctions combine their components with an OR operator.

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Abstract

#add_component, #add_conjunction, #add_negated_restriction, #add_negated_shorthand_restriction, #add_positive_restriction, #add_positive_shorthand_restriction, #add_restriction, #add_shorthand_restriction, #initialize, #negate, #negated?

Methods included from Filter

#tag, #to_filter_query

Constructor Details

This class inherits a constructor from Sunspot::Query::Connective::Abstract

Class Method Details

+ (Object) inverse



137
138
139
# File 'sunspot/lib/sunspot/query/connective.rb', line 137

def inverse
  Conjunction
end

Instance Method Details

- (Object) add_disjunction

No-op - this is already a disjunction



156
157
158
# File 'sunspot/lib/sunspot/query/connective.rb', line 156

def add_disjunction
  self
end

- (Object) to_boolean_phrase

Express this disjunction as a Lucene boolean phrase



145
146
147
148
149
150
151
# File 'sunspot/lib/sunspot/query/connective.rb', line 145

def to_boolean_phrase
  if @components.any? { |component| component.negated? }
    denormalize.to_boolean_phrase
  else
    super
  end
end