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



528
529
530
531
532
533
534
535
536
537
# File 'lib/droonga/searcher.rb', line 528

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

#format_attribute_column(label, column) ⇒ Object



519
520
521
522
# File 'lib/droonga/searcher.rb', line 519

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



524
525
526
# File 'lib/droonga/searcher.rb', line 524

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

#format_attribute_subrecs(label, sub_attributes) ⇒ Object



513
514
515
516
517
# File 'lib/droonga/searcher.rb', line 513

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