Class: Orchestrate::Search::StatsBuilder

Inherits:
Object
  • Object
show all
Includes:
AggregateBuilderDelegator, QueryBuilderDelegator
Defined in:
lib/orchestrate/search/aggregate_builder.rb

Overview

Stats Builder object for constructing stats functions to be included in the aggregate param

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builder, field_name) ⇒ StatsBuilder

Initialize a new RangeBuilder object

Parameters:



144
145
146
147
# File 'lib/orchestrate/search/aggregate_builder.rb', line 144

def initialize(builder, field_name)
  @builder = builder
  @field_name = field_name
end

Instance Attribute Details

#builderAggregateBuilder (readonly)

Returns:



136
137
138
# File 'lib/orchestrate/search/aggregate_builder.rb', line 136

def builder
  @builder
end

#field_name#to_s (readonly)

Returns The field to operate over.

Returns:

  • (#to_s)

    The field to operate over



139
140
141
# File 'lib/orchestrate/search/aggregate_builder.rb', line 139

def field_name
  @field_name
end

Instance Method Details

#to_param#to_s

Returns constructed aggregate string clause.

Returns:

  • (#to_s)

    constructed aggregate string clause



156
157
158
# File 'lib/orchestrate/search/aggregate_builder.rb', line 156

def to_param
  "#{field_name}:stats"
end

#to_sObject Also known as: inspect

Returns Pretty-Printed string representation of the StatsBuilder object.

Returns:

  • Pretty-Printed string representation of the StatsBuilder object



150
151
152
# File 'lib/orchestrate/search/aggregate_builder.rb', line 150

def to_s
  "#<Orchestrate::Search::StatsBuilder collection=#{collection.name} field_name=#{field_name}>"
end