Class: Redis::Commands::Search::GeoShapeField
- Defined in:
- lib/redis/commands/modules/search/field.rb
Overview
A GEOSHAPE field, indexing geometric shapes under a coordinate system.
Constant Summary collapse
- FLAT =
"FLAT"- SPHERICAL =
"SPHERICAL"
Instance Attribute Summary
Attributes inherited from Field
#alias_name, #name, #options, #query, #type
Instance Method Summary collapse
-
#initialize(name, coord_system = nil, **options) ⇒ GeoShapeField
constructor
Build a
GEOSHAPEfield. -
#to_args ⇒ Array
Render this field as the array of
FT.CREATESCHEMAtokens.
Constructor Details
#initialize(name, coord_system = nil, **options) ⇒ GeoShapeField
Build a GEOSHAPE field.
203 204 205 206 |
# File 'lib/redis/commands/modules/search/field.rb', line 203 def initialize(name, coord_system = nil, **) super(name, :geoshape, nil, **) @coord_system = coord_system end |
Instance Method Details
#to_args ⇒ Array
Render this field as the array of FT.CREATE SCHEMA tokens.
211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/redis/commands/modules/search/field.rb', line 211 def to_args args = [@name] args << "AS" << @alias_name if @alias_name args << @type.to_s.upcase args << @coord_system if @coord_system # Add suffix options (order mirrors the base Field: NOINDEX, INDEXMISSING, SORTABLE). # GEOSHAPE supports INDEXMISSING but not INDEXEMPTY/WITHSUFFIXTRIE. args << "NOINDEX" if @options[:no_index] args << "INDEXMISSING" if @options[:index_missing] args << "SORTABLE" if @options[:sortable] args end |