Class: Droonga::Searcher::ComplexAttributesFormatter

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



469
470
471
472
# File 'lib/droonga/searcher.rb', line 469

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

#format_attribute_expression(label, expression) ⇒ Object



474
475
476
# File 'lib/droonga/searcher.rb', line 474

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

#format_attribute_subrecs(label, sub_attributes) ⇒ Object



463
464
465
466
467
# File 'lib/droonga/searcher.rb', line 463

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

#format_attributes(attributes, table) ⇒ Object



478
479
480
481
482
483
484
485
486
# File 'lib/droonga/searcher.rb', line 478

def format_attributes(attributes, table)
  formatted_attributes = {}
  attributes.each do |attribute|
    formatted_attribute = format_attribute(attribute, table)
    attribute_name = attribute[:label]
    formatted_attributes[attribute_name] = formatted_attribute
  end
  formatted_attributes
end