Class: Droonga::Searcher::SimpleAttributesFormatter

Inherits:
Object
  • Object
show all
Includes:
AttributeFormattable
Defined in:
lib/droonga/searcher.rb

Instance Method Summary collapse

Methods included from AttributeFormattable

#format_attribute

Instance Method Details

#format_attribute_column(label, column) ⇒ Object



401
402
403
404
# File 'lib/droonga/searcher.rb', line 401

def format_attribute_column(label, column)
  vector = column.respond_to?(:vector?) ? column.vector? : false
  {"name" => label, "type" => column.range.name, "vector" => vector}
end

#format_attribute_expression(label, expression) ⇒ Object



406
407
408
# File 'lib/droonga/searcher.rb', line 406

def format_attribute_expression(label, expression)
  {"name" => label} # TODO include detailed information of expression
end

#format_attribute_subrecs(label, sub_attributes) ⇒ Object



394
395
396
397
398
399
# File 'lib/droonga/searcher.rb', line 394

def format_attribute_subrecs(label, sub_attributes)
  {
    "name" => label,
    "attributes" => sub_attributes,
  }
end

#format_attributes(attributes, table) ⇒ Object



410
411
412
413
414
# File 'lib/droonga/searcher.rb', line 410

def format_attributes(attributes, table)
  attributes.collect do |attribute|
    format_attribute(attribute, table)
  end
end