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



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

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



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

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

#format_attribute_subrecs(label, sub_attributes) ⇒ Object



388
389
390
391
392
393
# File 'lib/droonga/searcher.rb', line 388

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

#format_attributes(attributes, table) ⇒ Object



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

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