123456789_123456789_123456789_123456789_123456789_

Class: Redis::Commands::Search::VectorFieldDefinition

Relationships & Source Files
Inherits: Object
Defined in: lib/redis/commands/modules/search/schema.rb

Overview

The block DSL used by SchemaDefinition#vector_field to declare the attributes of a VectorField.

Class Method Summary

Instance Method Summary

Constructor Details

.new(field) ⇒ VectorFieldDefinition

[ GitHub ]

  
# File 'lib/redis/commands/modules/search/schema.rb', line 181

def initialize(field)
  @field = field
end

Instance Method Details

#dim(value) ⇒ Object

Set the vector dimensionality attribute.

Parameters:

  • value (Object)

    the DIM attribute value

Returns:

  • (Object)

    the stored value

[ GitHub ]

  
# File 'lib/redis/commands/modules/search/schema.rb', line 197

def dim(value)
  @field.add_attribute(:dim, value)
end

#distance_metric(value) ⇒ Object

Set the distance metric attribute (e.g. L2, COSINE).

Parameters:

  • value (Object)

    the DISTANCE_METRIC attribute value

Returns:

  • (Object)

    the stored value

[ GitHub ]

  
# File 'lib/redis/commands/modules/search/schema.rb', line 205

def distance_metric(value)
  @field.add_attribute(:distance_metric, value)
end

#type(value) ⇒ Object

Set the vector element type attribute (e.g. FLOAT32).

Parameters:

  • value (Object)

    the TYPE attribute value

Returns:

  • (Object)

    the stored value

[ GitHub ]

  
# File 'lib/redis/commands/modules/search/schema.rb', line 189

def type(value)
  @field.add_attribute(:type, value)
end