Class: Redis::Commands::Search::RangePredicate

Inherits:
Predicate
  • Object
show all
Defined in:
lib/redis/commands/modules/search/query.rb

Overview

A numeric-range predicate rendering (@field:[min max]).

Constant Summary

Constants inherited from Predicate

Predicate::TAG_ESCAPE_PATTERN, Predicate::TAG_SPECIAL_CHARACTERS, Predicate::TEXT_ESCAPE_PATTERN, Predicate::TEXT_SPECIAL_CHARACTERS

Instance Attribute Summary

Attributes inherited from Predicate

#field

Instance Method Summary collapse

Constructor Details

#initialize(field, min, max) ⇒ RangePredicate

Returns a new instance of RangePredicate.

Parameters:

  • field (String)

    the numeric field name

  • min (Numeric, String)

    the lower bound

  • max (Numeric, String)

    the upper bound



698
699
700
701
702
# File 'lib/redis/commands/modules/search/query.rb', line 698

def initialize(field, min, max)
  super(field)
  @min = min
  @max = max
end

Instance Method Details

#to_sString

Returns the query-string fragment, e.g. (@price:[10 20]).

Returns:

  • (String)

    the query-string fragment, e.g. (@price:[10 20])



705
706
707
# File 'lib/redis/commands/modules/search/query.rb', line 705

def to_s
  "(@#{@field}:[#{@min} #{@max}])"
end