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(attributes, table) ⇒ Object



499
500
501
502
503
504
505
506
507
# File 'lib/droonga/searcher.rb', line 499

def format(attributes, table)
  formatted_attributes = []
  attributes.each do |attribute|
    format_attribute(attribute, table) do |formatted_attribute|
      formatted_attributes << formatted_attribute
    end
  end
  formatted_attributes
end

#format_attribute_column(label, column) ⇒ Object



490
491
492
493
# File 'lib/droonga/searcher.rb', line 490

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



495
496
497
# File 'lib/droonga/searcher.rb', line 495

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

#format_attribute_subrecs(label, sub_attributes) ⇒ Object



483
484
485
486
487
488
# File 'lib/droonga/searcher.rb', line 483

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