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



420
421
422
423
# File 'lib/droonga/searcher.rb', line 420

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



425
426
427
# File 'lib/droonga/searcher.rb', line 425

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

#format_attribute_subrecs(label, sub_attributes) ⇒ Object



414
415
416
417
418
# File 'lib/droonga/searcher.rb', line 414

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

#format_attributes(attributes, table) ⇒ Object



429
430
431
432
433
434
435
436
437
# File 'lib/droonga/searcher.rb', line 429

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