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



533
534
535
536
537
538
539
540
541
542
# File 'lib/droonga/searcher.rb', line 533

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



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

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



529
530
531
# File 'lib/droonga/searcher.rb', line 529

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

#format_attribute_subrecs(label, sub_attributes) ⇒ Object



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

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