Sha256: a79e729ee63aab6e7664324bb10cb98f3944202d8f156244089ff0ae573ab9ca

Contents?: true

Size: 743 Bytes

Versions: 1

Compression:

Stored size: 743 Bytes

Contents

module Elastic::Core
  class QueryConfig
    attr_accessor :root, :groups, :limit, :offset, :middleware_options

    def self.initial_config
      new.tap do |config|
        config.root = Elastic::Nodes::Search.new
        config.root.query = Elastic::Nodes::Boolean.new
        config.root.query.disable_coord = true unless Elastic::Configuration.coord_similarity
        config.groups = []
        config.middleware_options = HashWithIndifferentAccess.new
      end
    end

    def clone
      self.class.new.tap do |clone|
        clone.root = @root.clone
        clone.groups = @groups.dup
        clone.limit = @limit
        clone.offset = @offset
        clone.middleware_options = @middleware_options.dup
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
elastic-rails-0.5.0 lib/elastic/core/query_config.rb