repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search.rb | lib/chewy/search.rb | require 'chewy/search/scoping'
require 'chewy/search/scrolling'
require 'chewy/search/query_proxy'
require 'chewy/search/parameters'
require 'chewy/search/response'
require 'chewy/search/loader'
require 'chewy/search/request'
require 'chewy/search/pagination/kaminari'
module Chewy
# This module being included to any... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/railtie.rb | lib/chewy/railtie.rb | module Chewy
class Railtie < Rails::Railtie
def self.all_engines
Rails::Engine.subclasses.map(&:instance) + [Rails.application]
end
class RequestStrategy
def initialize(app)
@app = app
end
def call(env)
# For Rails applications in `api_only` mode, the `assets` con... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/minitest.rb | lib/chewy/minitest.rb | require 'chewy/minitest/helpers'
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/multi_search.rb | lib/chewy/multi_search.rb | # frozen_string_literal: true
module Chewy
# `Chewy::MultiSearch` provides an interface for executing multiple
# queries via the Elasticsearch Multi Search API. When a MultiSearch
# is performed it wraps the responses from Elasticsearch and assigns
# them to the appropriate queries.
class MultiSearch
att... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/runtime.rb | lib/chewy/runtime.rb | require 'chewy/runtime/version'
module Chewy
module Runtime
def self.version
Chewy.current[:chewy_runtime_version] ||= Version.new(Chewy.client.info['version']['number'])
end
end
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/config.rb | lib/chewy/config.rb | module Chewy
class Config
include Singleton
attr_accessor :settings, :logger,
# The first strategy in stack. `:base` by default.
# If you need to return to the previous chewy behavior -
# just set it to `:bypass`
#
:roo... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/rspec.rb | lib/chewy/rspec.rb | require 'chewy/rspec/build_query'
require 'chewy/rspec/helpers'
require 'chewy/rspec/update_index'
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/minitest/search_index_receiver.rb | lib/chewy/minitest/search_index_receiver.rb | # Test helper class to provide minitest hooks for Chewy::Index testing.
#
# @note Intended to be used in conjunction with a test helper which mocks over the #bulk
# method on a {Chewy::Index} class. (See {Chewy::Minitest::Helpers})
#
# The class will capture the data from the *param on the Chewy::Index.bulk method an... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/minitest/helpers.rb | lib/chewy/minitest/helpers.rb | require_relative 'search_index_receiver'
module Chewy
module Minitest
module Helpers
extend ActiveSupport::Concern
# Assert that an index *changes* during a block.
# @param index [Chewy::Index] the index to watch, eg EntitiesIndex.
# @param strategy [Symbol] the Chewy strategy to use aro... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/rspec/build_query.rb | lib/chewy/rspec/build_query.rb | # Rspec helper to compare request and expected query
# To use it - add `require 'chewy/rspec/build_query'` to the `spec_helper.rb`
# Simple usage - just pass expected response as argument
# and then call needed query.
#
# expect { method1.method2...methodN }.to build_query(expected_query)
#
RSpec::Matchers.define :bu... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/rspec/update_index.rb | lib/chewy/rspec/update_index.rb | require 'active_support/core_ext/hash/keys'
# Rspec matcher `update_index`
# To use it - add `require 'chewy/rspec'` to the `spec_helper.rb`
# Simple usage - just pass index as argument.
#
# specify { expect { user.save! }.to update_index(UsersIndex) }
# specify { expect { user.save! }.to update_index('users') }
#... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/rspec/helpers.rb | lib/chewy/rspec/helpers.rb | module Chewy
module Rspec
module Helpers
extend ActiveSupport::Concern
# Rspec helper to mock elasticsearch response
# To use it - add `require 'chewy/rspec'` to the `spec_helper.rb`
#
# mock_elasticsearch_response(CitiesIndex, raw_response)
# expect(CitiesIndex.query({}).h... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/actions.rb | lib/chewy/index/actions.rb | module Chewy
class Index
# Module provides per-index actions, such as deletion,
# creation and existance check.
#
module Actions
extend ActiveSupport::Concern
module ClassMethods
# Checks index existance. Returns true or false
#
# UsersIndex.exists? #=> true
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/mapping.rb | lib/chewy/index/mapping.rb | module Chewy
class Index
module Mapping
extend ActiveSupport::Concern
included do
class_attribute :root_object, instance_reader: false, instance_writer: false
class_attribute :_templates
class_attribute :_agg_defs
self._agg_defs = {}
class_attribute :outdated_s... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/syncer.rb | lib/chewy/index/syncer.rb | module Chewy
class Index
# This class is able to find missing and outdated documents in the ES
# comparing ids from the data source and the ES index. Also, if `outdated_sync_field`
# exists in the index definition, it performs comparison of this field
# values for each source object and corresponding ... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/witchcraft.rb | lib/chewy/index/witchcraft.rb | begin
require 'method_source'
require 'parser/current'
require 'unparser'
rescue LoadError
nil
end
module Chewy
class Index
module Witchcraft
extend ActiveSupport::Concern
included do
class_attribute :_witchcraft, instance_reader: false, instance_writer: false
end
module... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/settings.rb | lib/chewy/index/settings.rb | module Chewy
class Index
# Stores ElasticSearch index settings and resolves `analysis`
# hash. At first, you need to store some analyzers or other
# analysis options to the corresponding repository:
#
# @example
# Chewy.analyzer :title_analyzer, type: 'custom', filter: %w(lowercase icu_foldi... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/specification.rb | lib/chewy/index/specification.rb | module Chewy
class Index
# Index specification is a combination of index settings and
# mappings. The idea behind this class is that specification
# can be locked in the `Chewy::Stash::Specification` between
# resets, so it is possible to track changes. In the future
# it is planned to be way smar... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/crutch.rb | lib/chewy/index/crutch.rb | module Chewy
class Index
module Crutch
extend ActiveSupport::Concern
included do
class_attribute :_crutches
self._crutches = {}
end
class Crutches
def initialize(index, collection)
@index = index
@collection = collection
@crutches_ins... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/aliases.rb | lib/chewy/index/aliases.rb | module Chewy
class Index
module Aliases
extend ActiveSupport::Concern
module ClassMethods
def indexes
indexes = empty_if_not_found { client.indices.get(index: index_name).keys }
indexes += empty_if_not_found { client.indices.get_alias(name: index_name).keys }
ind... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/import.rb | lib/chewy/index/import.rb | require 'chewy/index/import/journal_builder'
require 'chewy/index/import/bulk_builder'
require 'chewy/index/import/bulk_request'
require 'chewy/index/import/routine'
module Chewy
class Index
module Import
extend ActiveSupport::Concern
IMPORT_WORKER = lambda do |index, options, total, ids, iteration|... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/wrapper.rb | lib/chewy/index/wrapper.rb | module Chewy
class Index
module Wrapper
extend ActiveSupport::Concern
included do
attr_accessor :_data, :_object
attr_reader :attributes
end
module ClassMethods
def build(hit)
attributes = (hit['_source'] || {})
.reverse_merge(id: hit['_id'])... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/observe.rb | lib/chewy/index/observe.rb | require 'chewy/index/observe/callback'
require 'chewy/index/observe/active_record_methods'
module Chewy
class Index
module Observe
extend ActiveSupport::Concern
module ClassMethods
def update_index(objects, options = {})
Chewy.strategy.current.update(self, objects, options)
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/observe/callback.rb | lib/chewy/index/observe/callback.rb | module Chewy
class Index
module Observe
class Callback
def initialize(executable, filters = {})
@executable = executable
@if_filter = filters[:if]
@unless_filter = filters[:unless]
end
def call(context)
return if !@if_filter.nil? && !eval_filt... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/observe/active_record_methods.rb | lib/chewy/index/observe/active_record_methods.rb | module Chewy
class Index
module Observe
module Helpers
def update_proc(index_name, *args, &block)
options = args.extract_options!
method = args.first
proc do
reference = if index_name.is_a?(Proc)
if index_name.arity.zero?
insta... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/adapter/active_record.rb | lib/chewy/index/adapter/active_record.rb | require 'chewy/index/adapter/orm'
module Chewy
class Index
module Adapter
class ActiveRecord < Orm
def self.accepts?(target)
defined?(::ActiveRecord::Base) && (
(target.is_a?(Class) && target < ::ActiveRecord::Base) ||
target.is_a?(::ActiveRecord::Relation))
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/adapter/orm.rb | lib/chewy/index/adapter/orm.rb | require 'chewy/index/adapter/base'
module Chewy
class Index
module Adapter
class Orm < Base
attr_reader :default_scope
def initialize(target, **options)
if target.is_a?(relation_class)
@target = model_of_relation(target)
@default_scope = target
e... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/adapter/base.rb | lib/chewy/index/adapter/base.rb | module Chewy
class Index
module Adapter
# Basic adapter class. Contains interface, need to implement to add any classes support
class Base
BATCH_SIZE = 1000
attr_reader :target, :options
# Returns `true` if this adapter is applicable for the given target.
#
de... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/adapter/object.rb | lib/chewy/index/adapter/object.rb | require 'chewy/index/adapter/base'
module Chewy
class Index
module Adapter
# This adapter provides an ability to import documents from any
# source. You can actually use any class or even a symbol as
# a target.
#
# In case if a class is used - some of the additional features
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/import/bulk_request.rb | lib/chewy/index/import/bulk_request.rb | module Chewy
class Index
module Import
# Adds additional features to elasticsearch-api bulk method:
# * supports Chewy index suffix if necessary;
# * supports bulk_size, devides the passed body in chunks
# and peforms a separate request for each chunk;
# * returns only errored docu... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/import/journal_builder.rb | lib/chewy/index/import/journal_builder.rb | module Chewy
class Index
module Import
class JournalBuilder
def initialize(index, to_index: [], delete: [])
@index = index
@to_index = to_index
@delete = delete
end
def bulk_body
Chewy::Index::Import::BulkBuilder.new(
Chewy::Stash:... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/import/bulk_builder.rb | lib/chewy/index/import/bulk_builder.rb | module Chewy
class Index
module Import
# This class purpose is to build ES client-acceptable bulk
# request body from the passed objects for index and deletion.
# It handles parent-child relationships as well by fetching
# existing documents from ES and database, taking their join field va... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index/import/routine.rb | lib/chewy/index/import/routine.rb | module Chewy
class Index
module Import
# This class performs the import routine for the options and objects given.
#
# 0. Create target and journal indexes if needed.
# 1. Iterate over all the passed objects in batches.
# 2. For each batch {#process} method is called:
# * cre... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/runtime/version.rb | lib/chewy/runtime/version.rb | module Chewy
module Runtime
class Version
include Comparable
attr_reader :major, :minor, :patch
def initialize(version)
@major, @minor, @patch = *(version.to_s.split('.', 3) + ([0] * 3)).first(3).map(&:to_i)
end
def to_s
[major, minor, patch].join('.')
end
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/scoping.rb | lib/chewy/search/scoping.rb | module Chewy
module Search
# This module along with {Chewy::Search} provides an ability to
# use names scopes.
#
# @example
# class UsersIndex < Chewy::Index
# def self.by_name(name)
# query(match: {name: name})
# end
#
#
# def self.by_age(age)
# ... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/response.rb | lib/chewy/search/response.rb | module Chewy
module Search
# This class is a ES response hash wrapper.
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/_the_search_api.html
class Response
# @param body [Hash] response body hash
# @param loader [Chewy::Search::Loader] loader instance
def init... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/loader.rb | lib/chewy/search/loader.rb | module Chewy
module Search
# This class is used for two different purposes: load ORM/ODM
# source objects.
#
# @see Chewy::Index::Import
# @see Chewy::Search::Request#load
# @see Chewy::Search::Response#objects
# @see Chewy::Search::Scrolling#scroll_objects
class Loader
# @param ... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/query_proxy.rb | lib/chewy/search/query_proxy.rb | module Chewy
module Search
# This specialized proxy class is used to provide an ability
# of `query`, `filter`, `post_filter` parameters additional
# modification.
#
# @see Chewy::Search::Parameters::Query
# @see Chewy::Search::Parameters::Filter
# @see Chewy::Search::Parameters::PostFilte... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters.rb | lib/chewy/search/parameters.rb | Dir.glob(File.join(File.dirname(__FILE__), 'parameters', 'concerns', '*.rb')).each { |f| require f }
Dir.glob(File.join(File.dirname(__FILE__), 'parameters', '*.rb')).each { |f| require f }
module Chewy
module Search
# This class is basically a compound storage of the request
# parameter storages. It encapsu... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/request.rb | lib/chewy/search/request.rb | module Chewy
module Search
# The main request DSL class. Supports multiple index requests.
# Supports ES5 search API and query DSL.
#
# @note The class tries to be as immutable as possible,
# so most of the methods return a new instance of the class.
# @see Chewy::Search
# @example
#... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | true |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/scrolling.rb | lib/chewy/search/scrolling.rb | module Chewy
module Search
# This module contains batch requests DSL via ES scroll API. All the methods
# are optimized on memory consumption, they are not caching anythig, so
# use them when you need to do some single-run stuff on a huge amount of
# documents. Don't forget to tune the `scroll` parame... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/pagination/kaminari.rb | lib/chewy/search/pagination/kaminari.rb | module Chewy
module Search
module Pagination
# This module provides `Kaminari` support for {Chewy::Search::Request}
# It is included automatically if `Kaminari` is available.
#
# @example
# PlacesIndex.all.page(3).per(10).order(:name)
# # => <PlacesIndex::Query {..., :body=... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/storage.rb | lib/chewy/search/parameters/storage.rb | module Chewy
module Search
class Parameters
# Base parameter storage, defines a conventional API and
# its default behavior.
class Storage
class << self
attr_writer :param_name
# @!attribute [rw] param_name
# The parameter name is used on rendering, derived... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/allow_partial_search_results.rb | lib/chewy/search/parameters/allow_partial_search_results.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Stores boolean value, but has 3 states: `true`, `false` and `nil`.
#
# @see Chewy::Search::Request#allow_partial_search_results
# @see https://www.elastic.co/guide/en/elasticsearch/reference/6.4/search... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/source.rb | lib/chewy/search/parameters/source.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# This storage handles either an array of strings/symbols
# or a hash with `includes` and `excludes` keys and
# arrays of strings/symbols as values. Any other key is ignored.
#
# @see Chewy::Search... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/preference.rb | lib/chewy/search/parameters/preference.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard string value storage, nothing to see here.
#
# @see Chewy::Search::Parameters::StringStorage
# @see Chewy::Search::Request#preference
# @see https://www.elastic.co/guide/en/elasti... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/explain.rb | lib/chewy/search/parameters/explain.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard boolean storage, nothing to see here.
#
# @see Chewy::Search::Parameters::BoolStorage
# @see Chewy::Search::Request#explain
# @see https://www.elastic.co/guide/en/elasticsearch/re... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/version.rb | lib/chewy/search/parameters/version.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard boolean storage, nothing to see here.
#
# @see Chewy::Search::Parameters::BoolStorage
# @see Chewy::Search::Request#version
# @see https://www.elastic.co/guide/en/elasticsearch/re... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/limit.rb | lib/chewy/search/parameters/limit.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard integer value storage, nothing to see here.
#
# @see Chewy::Search::Parameters::IntegerStorage
# @see Chewy::Search::Request#limit
# @see https://www.elastic.co/guide/en/elasticse... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/order.rb | lib/chewy/search/parameters/order.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Sort parameter storage. Stores a hash of fields with the `nil`
# key if no options for the field were specified. Normalizer
# accepts an array of any hash-string-symbols combinations, or a hash.
#
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/track_total_hits.rb | lib/chewy/search/parameters/track_total_hits.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard boolean storage, nothing to see here.
#
# @see Chewy::Search::Parameters::BoolStorage
# @see Chewy::Search::Request#track_total_hits
# @see https://www.elastic.co/guide/en/elastic... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/post_filter.rb | lib/chewy/search/parameters/post_filter.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# A standard parameter storage, which updates `post_filter` parameter
# of the ES request.
#
# @example
# PlacesIndex.post_filter(match: {name: 'Moscow'})
# # => <PlacesIndex::Query {...,... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/offset.rb | lib/chewy/search/parameters/offset.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard integer value storage, nothing to see here.
#
# @see Chewy::Search::Parameters::IntegerStorage
# @see Chewy::Search::Request#offset
# @see https://www.elastic.co/guide/en/elastics... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/load.rb | lib/chewy/search/parameters/load.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Acts like standard hash storage, with one exception:
# all the keys are deeply symbolized for convenience.
#
# @see Chewy::Search::Request#load
# @see Chewy::Search::Loader
class Load < Sto... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/search_after.rb | lib/chewy/search/parameters/search_after.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Almost standard array storage without any typecasting.
# The value is simply replaced on update.
#
# @see Chewy::Search::Request#search_after
# @see https://www.elastic.co/guide/en/elasticsearch/... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/timeout.rb | lib/chewy/search/parameters/timeout.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard string value storage, nothing to see here.
#
# @see Chewy::Search::Parameters::StringStorage
# @see Chewy::Search::Request#timeout
# @see https://www.elastic.co/guide/en/elasticse... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/script_fields.rb | lib/chewy/search/parameters/script_fields.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard hash storage. Nothing to see here.
#
# @see Chewy::Search::Parameters::HashStorage
# @see Chewy::Search::Request#script_fields
# @see https://www.elastic.co/guide/en/elasticsearch... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/filter.rb | lib/chewy/search/parameters/filter.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# This parameter storage doesn't have its own parameter at the
# ES request body. Instead, it is embedded to the root `bool`
# query of the `query` request parameter. Some additional query
# reduction is... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/request_cache.rb | lib/chewy/search/parameters/request_cache.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Stores boolean value, but has 3 states: `true`, `false` and `nil`.
#
# @see Chewy::Search::Request#request_cache
# @see https://www.elastic.co/guide/en/elasticsearch/reference/5.4/shard-request-cache.h... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/aggs.rb | lib/chewy/search/parameters/aggs.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard hash storage. Nothing to see here.
#
# @see Chewy::Search::Parameters::HashStorage
# @see Chewy::Search::Request#aggregations
# @see https://www.elastic.co/guide/en/elasticsearch/... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/indices.rb | lib/chewy/search/parameters/indices.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Stores indices to query.
# Renders it to lists of string accepted by ElasticSearch
# API.
#
# If index is added to the storage, no matter, a class
# or a string/symbol, it gets appended to ... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/query.rb | lib/chewy/search/parameters/query.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# A standard parameter storage, which updates `query` parameter
# of the ES request.
#
# @example
# PlacesIndex.query(match: {name: 'Moscow'})
# # => <PlacesIndex::Query {..., :body=>{:qu... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/rescore.rb | lib/chewy/search/parameters/rescore.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Stores data as an array of hashes, exactly the same way
# ES requires `rescore` to be provided.
#
# @see Chewy::Search::Request#rescore
# @see https://www.elastic.co/guide/en/elasticsearch/refere... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/ignore_unavailable.rb | lib/chewy/search/parameters/ignore_unavailable.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Stores boolean value, but has 3 states: `true`, `false` and `nil`.
#
# @see Chewy::Search::Request#ignore_unavailable
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/min_score.rb | lib/chewy/search/parameters/min_score.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a simple value storage, all the values are coerced to float.
class MinScore < Storage
private
def normalize(value)
Float(value) if value
end
end
end
end
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/indices_boost.rb | lib/chewy/search/parameters/indices_boost.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Stores provided values as a string-float hash, but also takes
# keys order into account.
#
# @see Chewy::Search::Request#indices_boost
# @see https://www.elastic.co/guide/en/elasticsearch/referen... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/track_scores.rb | lib/chewy/search/parameters/track_scores.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard boolean storage, nothing to see here.
#
# @see Chewy::Search::Parameters::BoolStorage
# @see Chewy::Search::Request#track_scores
# @see https://www.elastic.co/guide/en/elasticsear... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/highlight.rb | lib/chewy/search/parameters/highlight.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard hash storage. Nothing to see here.
#
# @see Chewy::Search::Parameters::HashStorage
# @see Chewy::Search::Request#highlight
# @see https://www.elastic.co/guide/en/elasticsearch/ref... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/docvalue_fields.rb | lib/chewy/search/parameters/docvalue_fields.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# @see Chewy::Search::Parameters::StringArrayStorage
class DocvalueFields < Storage
include StringArrayStorage
end
end
end
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/profile.rb | lib/chewy/search/parameters/profile.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard boolean storage, nothing to see here.
#
# @see Chewy::Search::Parameters::BoolStorage
# @see Chewy::Search::Request#profile
# @see https://www.elastic.co/guide/en/elasticsearch/re... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/none.rb | lib/chewy/search/parameters/none.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard boolean storage, except the rendering logic.
#
# @see Chewy::Search::Parameters::BoolStorage
# @see Chewy::Search::Request#none
# @see https://en.wikipedia.org/wiki/Null_Object_pa... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/search_type.rb | lib/chewy/search/parameters/search_type.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard string value storage, nothing to see here.
#
# @see Chewy::Search::Parameters::StringStorage
# @see Chewy::Search::Request#search_type
# @see https://www.elastic.co/guide/en/elast... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/collapse.rb | lib/chewy/search/parameters/collapse.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard hash storage. Nothing to see here.
#
# @see Chewy::Search::Parameters::HashStorage
# @see Chewy::Search::Request#collapse
# @see https://www.elastic.co/guide/en/elasticsearch/refe... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/stored_fields.rb | lib/chewy/search/parameters/stored_fields.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# This storage is basically an array storage, but with an
# additional ability to pass `enabled` option.
#
# @see Chewy::Search::Request#stored_fields
# @see https://www.elastic.co/guide/en/elastic... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/terminate_after.rb | lib/chewy/search/parameters/terminate_after.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard integer value storage, nothing to see here.
#
# @see Chewy::Search::Parameters::IntegerStorage
# @see Chewy::Search::Request#terminate_after
# @see https://www.elastic.co/guide/en... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/knn.rb | lib/chewy/search/parameters/knn.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard hash storage. Nothing to see here.
#
# @see Chewy::Search::Parameters::HashStorage
# @see Chewy::Search::Request#knn
# @see https://www.elastic.co/guide/en/elasticsearch/reference... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/suggest.rb | lib/chewy/search/parameters/suggest.rb | require 'chewy/search/parameters/storage'
module Chewy
module Search
class Parameters
# Just a standard hash storage. Nothing to see here.
#
# @see Chewy::Search::Parameters::HashStorage
# @see Chewy::Search::Request#suggest
# @see https://www.elastic.co/guide/en/elasticsearch/refer... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/concerns/string_storage.rb | lib/chewy/search/parameters/concerns/string_storage.rb | module Chewy
module Search
class Parameters
# Just a simple value storage, all the values are coerced to string.
module StringStorage
private
def normalize(value)
value.to_s if value.present?
end
end
end
end
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/concerns/query_storage.rb | lib/chewy/search/parameters/concerns/query_storage.rb | require 'elasticsearch/dsl'
module Chewy
module Search
class Parameters
# This is a basic storage implementation for `query`, `filter`
# and `post_filter` storages. It uses `bool` query as a root
# structure for each of them. The `bool` root is omitted on
# rendering if there is only a si... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/concerns/string_array_storage.rb | lib/chewy/search/parameters/concerns/string_array_storage.rb | module Chewy
module Search
class Parameters
# Stores value as an array of strings.
module StringArrayStorage
# Unions two arrays.
#
# @see Chewy::Search::Parameters::Storage#update!
# @param other_value [String, Symbol, Array<String, Symbol>] any acceptable storage valu... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/concerns/bool_storage.rb | lib/chewy/search/parameters/concerns/bool_storage.rb | module Chewy
module Search
class Parameters
# Stores a boolean value. Any passed value is coerced to
# a boolean value.
module BoolStorage
# Performs values disjunction on update.
#
# @see Chewy::Search::Parameters::Storage#update!
# @param other_value [true, fals... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/concerns/hash_storage.rb | lib/chewy/search/parameters/concerns/hash_storage.rb | module Chewy
module Search
class Parameters
# Stores hashes with stringified keys.
module HashStorage
# Simply merges two value hashes on update
#
# @see Chewy::Search::Parameters::Storage#update!
# @param other_value [{String, Symbol => Object}] any acceptable storage ... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/search/parameters/concerns/integer_storage.rb | lib/chewy/search/parameters/concerns/integer_storage.rb | module Chewy
module Search
class Parameters
# Just a simple value storage, all the values are coerced to integer.
module IntegerStorage
private
def normalize(value)
Integer(value) if value
end
end
end
end
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/strategy/lazy_sidekiq.rb | lib/chewy/strategy/lazy_sidekiq.rb | module Chewy
class Strategy
# The strategy works the same way as sidekiq, but performs
# async evaluation of all index callbacks on model create and update
# driven by sidekiq
#
# Chewy.strategy(:lazy_sidekiq) do
# User.all.map(&:save) # Does nothing here
# Post.all.map(&:save) #... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/strategy/active_job.rb | lib/chewy/strategy/active_job.rb | module Chewy
class Strategy
# The strategy works the same way as atomic, but performs
# async index update driven by active_job
#
# Chewy.strategy(:active_job) do
# User.all.map(&:save) # Does nothing here
# Post.all.map(&:save) # And here
# # It imports all the changed users... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/strategy/sidekiq.rb | lib/chewy/strategy/sidekiq.rb | module Chewy
class Strategy
# The strategy works the same way as atomic, but performs
# async index update driven by sidekiq
#
# Chewy.strategy(:sidekiq) do
# User.all.map(&:save) # Does nothing here
# Post.all.map(&:save) # And here
# # It imports all the changed users and p... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/strategy/bypass.rb | lib/chewy/strategy/bypass.rb | module Chewy
class Strategy
# This strategy basically does nothing.
#
# Chewy.strategy(:bypass) do
# User.all.map(&:save) # Does nothing here
# # Does not update index all over the block.
# end
#
class Bypass < Base
def update(type, objects, _options = {}); end
en... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/strategy/base.rb | lib/chewy/strategy/base.rb | module Chewy
class Strategy
# This strategy raises exception on every index update
# asking to choose some other strategy.
#
# Chewy.strategy(:base) do
# User.all.map(&:save) # Raises UndefinedUpdateStrategy exception
# end
#
class Base
def name
self.class.name.de... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/strategy/atomic.rb | lib/chewy/strategy/atomic.rb | module Chewy
class Strategy
# This strategy accumulates all the objects prepared for
# indexing and fires index process when strategy is popped
# from the strategies stack.
#
# Chewy.strategy(:atomic) do
# User.all.map(&:save) # Does nothing here
# Post.all.map(&:save) # And here... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/strategy/urgent.rb | lib/chewy/strategy/urgent.rb | module Chewy
class Strategy
# This strategy updates index on demand. Not the best
# strategy in case of optimization. If you need to update
# indexes with bulk API calls - use :atomic instead.
#
# Chewy.strategy(:urgent) do
# User.all.map(&:save) # Updates index on every `save` call
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/strategy/delayed_sidekiq.rb | lib/chewy/strategy/delayed_sidekiq.rb | # frozen_string_literal: true
module Chewy
class Strategy
class DelayedSidekiq < Sidekiq
require_relative 'delayed_sidekiq/scheduler'
# cleanup the redis sets used internally. Useful mainly in tests to avoid
# leak and potential flaky tests.
def self.clear_timechunks!
::Sidekiq.r... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/strategy/atomic_no_refresh.rb | lib/chewy/strategy/atomic_no_refresh.rb | module Chewy
class Strategy
# This strategy works like atomic but import objects with `refresh=false` parameter.
#
# Chewy.strategy(:atomic_no_refresh) do
# User.all.map(&:save) # Does nothing here
# Post.all.map(&:save) # And here
# # It imports all the changed users and posts r... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/strategy/delayed_sidekiq/scheduler.rb | lib/chewy/strategy/delayed_sidekiq/scheduler.rb | # frozen_string_literal: true
require_relative '../../index'
# The class is responsible for accumulating in redis [type, ids]
# that were requested to be reindexed during `latency` seconds.
# The reindex job is going to be scheduled after a `latency` seconds.
# that job is going to read accumulated [type, ids] from t... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/strategy/delayed_sidekiq/worker.rb | lib/chewy/strategy/delayed_sidekiq/worker.rb | # frozen_string_literal: true
module Chewy
class Strategy
class DelayedSidekiq
class Worker
include ::Sidekiq::Worker
LUA_SCRIPT = <<~LUA
local type = ARGV[1]
local score = tonumber(ARGV[2])
local prefix = ARGV[3]
local timechunks_key = prefix .. ":"... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/fields/base.rb | lib/chewy/fields/base.rb | module Chewy
module Fields
class Base
attr_reader :name, :join_options, :options, :children
attr_accessor :parent # used by Chewy::Index::Mapping to expand nested fields
def initialize(name, value: nil, **options)
@name = name.to_sym
@options = {}
update_options!(**optio... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/fields/root.rb | lib/chewy/fields/root.rb | module Chewy
module Fields
class Root < Chewy::Fields::Base
attr_reader :dynamic_templates, :id
def initialize(name, **options)
super
@value ||= -> { self }
@dynamic_templates = []
end
def update_options!(**options)
@id = options.fetch(:id, options.fetch(... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/generators/chewy/install_generator.rb | lib/generators/chewy/install_generator.rb | module Chewy
module Generators
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __dir__)
def copy_configuration
template 'chewy.yml', 'config/chewy.yml'
end
end
end
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
github/pages-gem | https://github.com/github/pages-gem/blob/cd7369a21e3ec3f20753012da8e312859dca41a4/spec/github-pages_spec.rb | spec/github-pages_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe(GitHubPages) do
it "exposes its version" do
expect(described_class::VERSION).to be_a(Integer)
end
end
| ruby | MIT | cd7369a21e3ec3f20753012da8e312859dca41a4 | 2026-01-04T16:00:19.865464Z | false |
github/pages-gem | https://github.com/github/pages-gem/blob/cd7369a21e3ec3f20753012da8e312859dca41a4/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require File.expand_path("../lib/github-pages.rb", __dir__)
require "open3"
require "webmock/rspec"
RSpec.configure do |config|
config.run_all_when_everything_filtered = true
config.filter_run :focus
# Run specs in random order to surface order dependencies. If you find an
# ord... | ruby | MIT | cd7369a21e3ec3f20753012da8e312859dca41a4 | 2026-01-04T16:00:19.865464Z | false |
github/pages-gem | https://github.com/github/pages-gem/blob/cd7369a21e3ec3f20753012da8e312859dca41a4/spec/github-pages/dependencies_spec.rb | spec/github-pages/dependencies_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe(GitHubPages::Dependencies) do
CORE_DEPENDENCIES = %w(
jekyll kramdown kramdown-parser-gfm liquid rouge jekyll-sass-converter
github-pages-health-check
).freeze
PLUGINS = described_class::VERSIONS.keys - CORE_DEPENDENCIES
it "exposes its gem... | ruby | MIT | cd7369a21e3ec3f20753012da8e312859dca41a4 | 2026-01-04T16:00:19.865464Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.