class Orchestrate::Search::TopValuesBuilder

Stats Builder object for constructing top-values functions to be included in the aggregate param

Attributes

builder[R]

@return [AggregateBuilder]

field_name[R]

@return [#to_s] The field to operate over

Public Class Methods

new(builder, field_name, offset=nil, limit=nil) click to toggle source

Initialize a new TopValuesBuilder object @param builder [AggregateBuilder] The Aggregate Builder object @param field_name [#to_s] The field to operate over @param offset [Integer,nil] The zero-based index of the first paged value to retrieve in this aggregation. If omitted, uses the server default value of zero. @param limit [Integer,nil] The maximum number of values to retrieve per page of results for this aggregation. If omitted, uses the server default value of ten.

# 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

Public Instance Methods

inspect()
Alias for: to_s
to_param() click to toggle source

@return [#to_s] constructed aggregate string clause

# 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() click to toggle source

@return [#to_s] Pretty-Printed string representation of the TopValuesBuilder object

# 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
Also aliased as: inspect