Class: Fluent::GroongaOutput::TableDefinition::IndexDefinition

Inherits:
Object
  • Object
show all
Includes:
DefinitionParseMethods
Defined in:
lib/fluent/plugin/out_groonga.rb

Instance Method Summary collapse

Constructor Details

#initialize(table, raw) ⇒ IndexDefinition

Returns a new instance of IndexDefinition.



212
213
214
215
# File 'lib/fluent/plugin/out_groonga.rb', line 212

def initialize(table, raw)
  @table = table
  @raw = raw
end

Instance Method Details

#flagsObject



229
230
231
232
233
234
# File 'lib/fluent/plugin/out_groonga.rb', line 229

def flags
  _flags = ["COLUMN_INDEX"]
  _flags << "WITH_POSITION" if @table.default_tokenizer
  _flags << "WITH_SECTION" if source_columns.size >= 2
  _flags
end

#nameObject



217
218
219
# File 'lib/fluent/plugin/out_groonga.rb', line 217

def name
  @raw[:name]
end

#source_columnsObject



225
226
227
# File 'lib/fluent/plugin/out_groonga.rb', line 225

def source_columns
  parse_items(@raw[:source_columns])
end

#source_tableObject



221
222
223
# File 'lib/fluent/plugin/out_groonga.rb', line 221

def source_table
  @raw[:source_table]
end

#to_create_argumentsObject



236
237
238
239
240
241
242
243
244
# File 'lib/fluent/plugin/out_groonga.rb', line 236

def to_create_arguments
  {
    "table"  => @table.name,
    "name"   => name,
    "flags"  => flags.join("|"),
    "type"   => source_table,
    "source" => source_columns.join(","),
  }
end