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_attribute_column(label, column) ⇒ Object



444
445
446
447
# File 'lib/droonga/searcher.rb', line 444

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



449
450
451
# File 'lib/droonga/searcher.rb', line 449

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

#format_attribute_subrecs(label, sub_attributes) ⇒ Object



437
438
439
440
441
442
# File 'lib/droonga/searcher.rb', line 437

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

#format_attributes(attributes, table) ⇒ Object



453
454
455
456
457
# File 'lib/droonga/searcher.rb', line 453

def format_attributes(attributes, table)
  attributes.collect do |attribute|
    format_attribute(attribute, table)
  end
end