Class: Orchestrate::Search::TopValuesBuilder
- Inherits:
-
Object
- Object
- Orchestrate::Search::TopValuesBuilder
- Includes:
- AggregateBuilderDelegator, QueryBuilderDelegator
- Defined in:
- lib/orchestrate/search/aggregate_builder.rb
Overview
Stats Builder object for constructing top-values functions to be included in the aggregate param
Instance Attribute Summary collapse
- #builder ⇒ AggregateBuilder readonly
-
#field_name ⇒ #to_s
readonly
The field to operate over.
Instance Method Summary collapse
-
#initialize(builder, field_name, offset = nil, limit = nil) ⇒ TopValuesBuilder
constructor
Initialize a new TopValuesBuilder object If omitted, uses the server default value of zero.
-
#to_param ⇒ #to_s
Constructed aggregate string clause.
-
#to_s ⇒ #to_s
(also: #inspect)
Pretty-Printed string representation of the TopValuesBuilder object.
Constructor Details
#initialize(builder, field_name, offset = nil, limit = nil) ⇒ TopValuesBuilder
Initialize a new TopValuesBuilder object If omitted, uses the server default value of zero. If omitted, uses the server default value of ten.
104 105 106 107 108 109 110 111 112 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 104 def initialize(builder, field_name, offset=nil, limit=nil) @builder = builder @field_name = field_name if offset.nil? ^ limit.nil? raise ArgumentError, "offset and limit arguments can only be supplied together, or not at all" end @offset = offset @limit = limit end |
Instance Attribute Details
#builder ⇒ AggregateBuilder (readonly)
92 93 94 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 92 def builder @builder end |
#field_name ⇒ #to_s (readonly)
Returns The field to operate over.
95 96 97 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 95 def field_name @field_name end |
Instance Method Details
#to_param ⇒ #to_s
Returns constructed aggregate string clause.
121 122 123 124 125 126 127 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 121 def to_param if @offset.nil? && @limit.nil? "#{@field_name}:top_values" else "#{@field_name}:top_values:offset:#{@offset}:limit:#{@limit}" end end |
#to_s ⇒ #to_s Also known as: inspect
Returns Pretty-Printed string representation of the TopValuesBuilder object.
115 116 117 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 115 def to_s "#<Orchestrate::Search::TopValuesBuilder collection=#{collection.name} field_name=#{@field_name} offset=#{@offset} limit=#{@limit}>" end |