Class: Droonga::Searcher::ComplexAttributesFormatter
- Inherits:
-
Object
- Object
- Droonga::Searcher::ComplexAttributesFormatter
- Includes:
- AttributeFormattable
- Defined in:
- lib/droonga/searcher.rb
Instance Method Summary collapse
- #format(attributes, table) ⇒ Object
- #format_attribute_column(label, column) ⇒ Object
- #format_attribute_expression(label, expression) ⇒ Object
- #format_attribute_subrecs(label, sub_attributes) ⇒ Object
Methods included from AttributeFormattable
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 |