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

Inherits:
Abstract
  • Object
show all
Defined in:
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_restriction, #add_shorthand_restriction, #initialize, #negate, #negated?

Constructor Details

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

Class Method Details

.inverseObject



120
121
122
# File 'lib/sunspot/query/connective.rb', line 120

def inverse
  Conjunction
end

Instance Method Details

#add_disjunctionObject

No-op - this is already a disjunction



139
140
141
# File 'lib/sunspot/query/connective.rb', line 139

def add_disjunction
  self
end

#to_boolean_phraseObject

Express this disjunction as a Lucene boolean phrase



128
129
130
131
132
133
134
# File 'lib/sunspot/query/connective.rb', line 128

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