Class: Orchestrate::Search::AggregateResult

Inherits:
Object
  • Object
show all
Defined in:
lib/orchestrate/search/results.rb

Overview

Base object representing an individual Aggregate result

Direct Known Subclasses

RangeResult, StatsResult

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collection, listing) ⇒ AggregateResult

Initialize a new AggregateResult object

Parameters:

  • collection (Orchestrate::Collection)

    The collection searched.

  • listing (#to_json)

    The aggregate result returned from the search.



116
117
118
119
120
121
# File 'lib/orchestrate/search/results.rb', line 116

def initialize(collection, listing)
  @collection = collection
  @kind = listing['aggregate_kind']
  @field_name = listing['field_name']
  @count = listing['value_count']
end

Instance Attribute Details

#collectionCollection (readonly)

Returns The collection searched.

Returns:



102
103
104
# File 'lib/orchestrate/search/results.rb', line 102

def collection
  @collection
end

#countInteger (readonly)

Returns Number of field values included in the aggregate function.

Returns:

  • (Integer)

    Number of field values included in the aggregate function.



111
112
113
# File 'lib/orchestrate/search/results.rb', line 111

def count
  @count
end

#field_name#to_s (readonly)

Returns The field name the aggregate function operated over.

Returns:

  • (#to_s)

    The field name the aggregate function operated over.



108
109
110
# File 'lib/orchestrate/search/results.rb', line 108

def field_name
  @field_name
end

#kind#to_s (readonly)

Returns The aggregate kind/type.

Returns:

  • (#to_s)

    The aggregate kind/type



105
106
107
# File 'lib/orchestrate/search/results.rb', line 105

def kind
  @kind
end