@@ -406,7 +406,7 @@ def initialize
406
406
407
407
# @return [Hash<Symbol, #to_json>]
408
408
def to_h
409
- raise ArgumentError , "either start_time or end_time must be set for DateRangeQuery" if @start_time . nil? && @end_time . nil?
409
+ raise Error :: InvalidArgument , "either start_time or end_time must be set for DateRangeQuery" if @start_time . nil? && @end_time . nil?
410
410
411
411
data = { }
412
412
data [ :boost ] = boost if boost
@@ -483,7 +483,7 @@ def initialize
483
483
484
484
# @return [Hash<Symbol, #to_json>]
485
485
def to_h
486
- raise ArgumentError , "either min or max must be set for NumericRangeQuery" if @min . nil? && @max . nil?
486
+ raise Error :: InvalidArgument , "either min or max must be set for NumericRangeQuery" if @min . nil? && @max . nil?
487
487
488
488
data = { }
489
489
data [ :boost ] = boost if boost
@@ -551,7 +551,7 @@ def initialize
551
551
552
552
# @return [Hash<Symbol, #to_json>]
553
553
def to_h
554
- raise ArgumentError , "either min or max must be set for TermRangeQuery" if @min . nil? && @max . nil?
554
+ raise Error :: InvalidArgument , "either min or max must be set for TermRangeQuery" if @min . nil? && @max . nil?
555
555
556
556
data = { }
557
557
data [ :boost ] = boost if boost
@@ -754,7 +754,7 @@ def empty?
754
754
755
755
# @return [Hash<Symbol, #to_json>]
756
756
def to_h
757
- raise ArgumentError , "compound conjunction query must have sub-queries" if @queries . nil? || @queries . empty?
757
+ raise Error :: InvalidArgument , "compound conjunction query must have sub-queries" if @queries . nil? || @queries . empty?
758
758
759
759
data = { :conjuncts => @queries . uniq . map ( &:to_h ) }
760
760
data [ :boost ] = boost if boost
@@ -799,11 +799,11 @@ def empty?
799
799
800
800
# @return [Hash<Symbol, #to_json>]
801
801
def to_h
802
- raise ArgumentError , "compound disjunction query must have sub-queries" if @queries . nil? || @queries . empty?
802
+ raise Error :: InvalidArgument , "compound disjunction query must have sub-queries" if @queries . nil? || @queries . empty?
803
803
804
804
data = { :disjuncts => @queries . uniq . map ( &:to_h ) }
805
805
if min
806
- raise ArgumentError , "disjunction query has fewer sub-queries than configured minimum" if @queries . size < min
806
+ raise Error :: InvalidArgument , "disjunction query has fewer sub-queries than configured minimum" if @queries . size < min
807
807
808
808
data [ :min ] = min
809
809
end
@@ -828,7 +828,7 @@ class BooleanQuery < SearchQuery
828
828
829
829
# @yieldparam [BooleanQuery] self
830
830
def initialize
831
- super ( )
831
+ super
832
832
@must = ConjunctionQuery . new
833
833
@must_not = DisjunctionQuery . new
834
834
@should = DisjunctionQuery . new
@@ -861,7 +861,10 @@ def should(*queries)
861
861
862
862
# @return [Hash<Symbol, #to_json>]
863
863
def to_h
864
- raise ArgumentError , "BooleanQuery must have at least one non-empty sub-query" if @must . empty? && @must_not . empty? && @should . empty?
864
+ if @must . empty? && @must_not . empty? && @should . empty?
865
+ raise Error ::InvalidArgument ,
866
+ "BooleanQuery must have at least one non-empty sub-query"
867
+ end
865
868
866
869
data = { }
867
870
data [ :must ] = @must . to_h unless @must . empty?
@@ -1007,7 +1010,7 @@ def self.match_all(&block)
1007
1010
class MatchAllQuery < SearchQuery
1008
1011
# @yieldparam [MatchAllQuery] self
1009
1012
def initialize
1010
- super ( )
1013
+ super
1011
1014
yield self if block_given?
1012
1015
end
1013
1016
@@ -1030,7 +1033,7 @@ def self.match_none(&block)
1030
1033
class MatchNoneQuery < SearchQuery
1031
1034
# @yieldparam [MatchNoneQuery] self
1032
1035
def initialize
1033
- super ( )
1036
+ super
1034
1037
yield self if block_given?
1035
1038
end
1036
1039
0 commit comments