Class: Redis::Commands::Search::TagField

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

Overview

A TAG field, indexing one or more delimited tag tokens.

Instance Attribute Summary

Attributes inherited from Field

#alias_name, #name, #options, #query, #type

Instance Method Summary collapse

Methods inherited from Field

#to_args

Constructor Details

#initialize(name, query = nil, **options) ⇒ TagField

Build a TAG field.

Parameters:

  • name (String, Symbol)

    the document attribute the field indexes

  • query (Query, nil) (defaults to: nil)

    a query the field is bound to, enabling #eq

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • :separator (String)

    the tag separator character (+SEPARATOR+)

  • :case_sensitive (Boolean)

    keep tag casing (+CASESENSITIVE+)



72
73
74
# File 'lib/redis/commands/modules/search/field.rb', line 72

def initialize(name, query = nil, **options)
  super(name, :tag, query, **options)
end

Instance Method Details

#eq(value) ⇒ Query

Add a tag-equality predicate (+@field:value+) to the bound query.

Parameters:

  • value (String)

    the tag to match

Returns:

  • (Query)

    the bound query with the predicate added



80
81
82
# File 'lib/redis/commands/modules/search/field.rb', line 80

def eq(value)
  query.add_predicate(TagEqualityPredicate.new(@alias_name || name, value))
end