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 |
|---|---|---|---|---|---|---|---|---|
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/integration/scan_test.rb | test/integration/scan_test.rb | require 'test_helper'
module Tire
class ScanIntegrationTest < Test::Unit::TestCase
include Test::Integration
context "Scan" do
setup do
documents = (1..100).map { |i| { id: i, type: 'test', title: "Document #{i}" } }
Tire.index 'scantest' do
delete
create :setting... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/active_record_models.rb | test/models/active_record_models.rb | require 'active_record'
class ActiveRecordArticle < ActiveRecord::Base
has_many :comments, :class_name => "ActiveRecordComment", :foreign_key => "article_id"
has_many :stats, :class_name => "ActiveRecordStat", :foreign_key => "article_id"
include Tire::Model::Search
include Tire::Model::Callbacks
tir... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/persistent_article_in_namespace.rb | test/models/persistent_article_in_namespace.rb | # Example namespaced class with Elasticsearch persistence
#
# The `document_type` is `my_namespace/persistent_article_in_namespace`
#
module MyNamespace
class PersistentArticleInNamespace
include Tire::Model::Persistence
property :title
end
end
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/validated_model.rb | test/models/validated_model.rb | # Example ActiveModel with validations
class ValidatedModel
include Tire::Model::Persistence
property :name
validates_presence_of :name
end
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/active_model_article_with_custom_index_name.rb | test/models/active_model_article_with_custom_index_name.rb | # Example ActiveModel class with custom index name
require File.expand_path('../active_model_article', __FILE__)
class ActiveModelArticleWithCustomIndexName < ActiveModelArticle
index_name 'custom-index-name'
end
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/persistent_article_in_index.rb | test/models/persistent_article_in_index.rb | # Example class with Elasticsearch persistence in index `persistent_articles`
#
# The `index` is `persistent_articles`
#
class PersistentArticleInIndex
include Tire::Model::Persistence
property :title
property :published_on
property :tags
index_name "persistent_articles"
end
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/persistent_article.rb | test/models/persistent_article.rb | # Example class with Elasticsearch persistence
class PersistentArticle
include Tire::Model::Persistence
property :title
property :published_on
property :tags
end
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/article.rb | test/models/article.rb | # Example non-ActiveModel custom wrapper for result item
class Article
attr_reader :id, :title, :body
def initialize(attributes={})
attributes.each { |k,v| instance_variable_set(:"@#{k}", v) }
end
def to_json(options={})
{ :id => @id, :title => @title, :body => @body }.to_json
end
alias :to_inde... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/active_model_article.rb | test/models/active_model_article.rb | # Example ActiveModel class
require 'rubygems'
require 'active_model'
class ActiveModelArticle
extend ActiveModel::Naming
include ActiveModel::AttributeMethods
include ActiveModel::Serialization
include ActiveModel::Serializers::JSON
include Tire::Model::Search
attr_reader :attributes
def initializ... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/active_model_article_with_callbacks.rb | test/models/active_model_article_with_callbacks.rb | # Example ActiveModel class with callbacks
require 'rubygems'
require 'active_model'
class ActiveModelArticleWithCallbacks
include ActiveModel::AttributeMethods
include ActiveModel::Validations
include ActiveModel::Serialization
include ActiveModel::Serializers::JSON
include ActiveModel::Naming
extend ... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/persistent_articles_with_custom_index_name.rb | test/models/persistent_articles_with_custom_index_name.rb | # Example class with Elasticsearch persistence and custom index name
class PersistentArticleWithCustomIndexName
include Tire::Model::Persistence
property :title
index_name 'custom-index-name'
end
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/persistent_article_with_percolation.rb | test/models/persistent_article_with_percolation.rb | class PersistentArticleWithPercolation
include Tire::Model::Persistence
property :title
percolate!
end
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/active_model_article_with_custom_document_type.rb | test/models/active_model_article_with_custom_document_type.rb | # Example ActiveModel class with custom document type
require File.expand_path('../active_model_article', __FILE__)
class ActiveModelArticleWithCustomDocumentType < ActiveModelArticle
document_type 'my_custom_type'
end
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/supermodel_article.rb | test/models/supermodel_article.rb | # Example ActiveModel class for testing :searchable mode
require 'rubygems'
require 'redis/persistence'
class SupermodelArticle
include Redis::Persistence
include Tire::Model::Search
include Tire::Model::Callbacks
property :title
mapping do
indexes :title, :type => 'string', :boost => 15, :analy... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/mongoid_models.rb | test/models/mongoid_models.rb | require 'mongoid'
class MongoidArticle
include Mongoid::Document
has_many :comments, :class_name => "MongoidComment", :foreign_key => "article_id"
has_many :stats, :class_name => "MongoidStat", :foreign_key => "article_id"
include Tire::Model::Search
include Tire::Model::Callbacks
tire do
ma... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/persistent_article_with_strict_mapping.rb | test/models/persistent_article_with_strict_mapping.rb | # Example class with Elasticsearch persistence and strict mapping
class PersistentArticleWithStrictMapping
include Tire::Model::Persistence
mapping :dynamic => 'strict' do
property :title, :type => 'string'
property :created, :type => 'date'
end
def myproperty
@myproperty
end
def myproper... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/persistent_article_with_casting.rb | test/models/persistent_article_with_casting.rb | class Author
attr_accessor :first_name, :last_name
def initialize(attributes)
@first_name = HashWithIndifferentAccess.new(attributes)[:first_name]
@last_name = HashWithIndifferentAccess.new(attributes)[:last_name]
end
end
class Comment
def initialize(params); @attributes = HashWit... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/models/persistent_article_with_defaults.rb | test/models/persistent_article_with_defaults.rb | class PersistentArticleWithDefaults
include Tire::Model::Persistence
property :title
property :published_on
property :tags, :default => []
property :hidden, :default => false
property :options, :type => 'object', :default => {:switches => []}
property :created_at, :default => lambda { Time.... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/search_filter_test.rb | test/unit/search_filter_test.rb | require 'test_helper'
module Tire::Search
class FilterTest < Test::Unit::TestCase
context "Filter" do
should "be serialized to JSON" do
assert_respond_to Filter.new(:terms, {}), :to_json
end
should "encode simple filter declarations as JSON" do
assert_equal( { :terms => {} }... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/logger_test.rb | test/unit/logger_test.rb | require 'test_helper'
require 'time'
module Tire
class LoggerTest < Test::Unit::TestCase
include Tire
context "Logger" do
context "initialized with an IO object" do
should "take STDOUT" do
assert_nothing_raised do
logger = Logger.new STDOUT
end
end
... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/search_sort_test.rb | test/unit/search_sort_test.rb | require 'test_helper'
module Tire::Search
class SortTest < Test::Unit::TestCase
context "Sort" do
should "be serialized to JSON" do
assert_respond_to Sort.new, :to_json
end
should "encode simple strings" do
assert_equal [:foo].to_json, Sort.new.by(:foo).to_json
end
... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/model_callbacks_test.rb | test/unit/model_callbacks_test.rb | require 'test_helper'
class ModelOne
extend ActiveModel::Naming
include Tire::Model::Search
include Tire::Model::Callbacks
def save; false; end
def destroy; false; end
end
class ModelTwo
extend ActiveModel::Naming
extend ActiveModel::Callbacks
define_model_callbacks :save, :destroy
inclu... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/model_initialization_test.rb | test/unit/model_initialization_test.rb | require 'test_helper'
class ModelWithIncorrectMapping
extend ActiveModel::Naming
include Tire::Model::Search
include Tire::Model::Callbacks
tire do
mapping do
indexes :title, :type => 'boo'
end
end
end
class MyModelForIndexCreate
extend ActiveModel::Naming
include Tire::Model::Search
en... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/http_client_test.rb | test/unit/http_client_test.rb | require 'test_helper'
module Tire
module HTTP
class ClientTest < Test::Unit::TestCase
context "RestClient" do
should "be default" do
assert_equal Client::RestClient, Configuration.client
end
should "respond to HTTP methods" do
assert_respond_to Client::RestCl... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/search_script_field_test.rb | test/unit/search_script_field_test.rb | require 'test_helper'
module Tire::Search
class ScriptFieldTest < Test::Unit::TestCase
context "ScriptField" do
should "be serialized to JSON" do
assert_respond_to ScriptField.new(:test1, {}), :to_json
end
should "encode simple declarations as JSON" do
assert_equal( { :test1... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/search_test.rb | test/unit/search_test.rb | require 'test_helper'
module Tire
class SearchTest < Test::Unit::TestCase
context "Search" do
setup { Configuration.reset }
should "be initialized with single index" do
s = Search::Search.new('index') { query { string 'foo' } }
assert_match %r|/index/_search|, s.url
end
... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/index_alias_test.rb | test/unit/index_alias_test.rb | require 'test_helper'
module Tire
class IndexAliasTest < Test::Unit::TestCase
context "Index Alias" do
teardown { Configuration.reset }
context "initialization" do
should "have a name and defaults" do
@alias = Alias.new :name => 'dummy'
assert_equal 'dummy', @alias.nam... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/tire_test.rb | test/unit/tire_test.rb | require 'test_helper'
module Tire
class TireTest < Test::Unit::TestCase
context "Tire" do
should "have the DSL methods available" do
assert_respond_to Tire, :search
assert_respond_to Tire, :index
assert_respond_to Tire, :configure
end
context "DSL" do
should... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/index_test.rb | test/unit/index_test.rb | # encoding: UTF-8
require 'test_helper'
module Tire
class IndexTest < Test::Unit::TestCase
context "Index" do
setup do @index = Tire::Index.new 'dummy' end
teardown do Tire.configure { reset } end
should "have a name" do
assert_equal 'dummy', @index.name
end
... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | true |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/model_search_test.rb | test/unit/model_search_test.rb | require 'test_helper'
class ModelWithIndexCallbacks
extend ActiveModel::Naming
extend ActiveModel::Callbacks
include Tire::Model::Search
include Tire::Model::Callbacks
def destroyed?; false; end
def serializable_hash; {:one => 1}; end
end
module Tire
module Model
class SearchTest... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | true |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/http_response_test.rb | test/unit/http_response_test.rb | require 'test_helper'
module Tire
module HTTP
class ResponseTest < Test::Unit::TestCase
context "Response" do
should "take response body, code and headers on initialization" do
response = Response.new "http response body",
200,
... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/count_test.rb | test/unit/count_test.rb | require 'test_helper'
module Tire
class CountTest < Test::Unit::TestCase
context "Count" do
setup { Configuration.reset }
should "be initialized with single index" do
c = Search::Count.new('index')
assert_equal ['index'], c.indices
assert_match %r|/index/_count|, c.url
... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/active_model_lint_test.rb | test/unit/active_model_lint_test.rb | require 'test_helper'
module Tire
module Model
class ActiveModelLintTest < Test::Unit::TestCase
include ActiveModel::Lint::Tests
def setup
@model = PersistentArticle.new :title => 'Test'
end
end
end
end
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/model_import_test.rb | test/unit/model_import_test.rb | require 'test_helper'
class ImportModel
extend ActiveModel::Naming
include Tire::Model::Search
include Tire::Model::Callbacks
DATA = (1..4).to_a
def self.paginate(options={})
options = {:page => 1, :per_page => 1000}.update options
DATA.slice( (options[:page]-1)*options[:per_page]...options[:page]... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/results_collection_test.rb | test/unit/results_collection_test.rb | require 'test_helper'
module Tire
class ResultsCollectionTest < Test::Unit::TestCase
context "Collection" do
setup do
begin; Object.send(:remove_const, :Rails); rescue; end
Configuration.reset
@default_response = { 'hits' => { 'hits' => [{'_id' => 1, '_score' => 1, '_source' => {:... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/results_item_test.rb | test/unit/results_item_test.rb | require 'test_helper'
module Tire
class ResultsItemTest < Test::Unit::TestCase
# ActiveModel compatibility tests
#
def setup
super
begin; Object.send(:remove_const, :Rails); rescue; end
@model = Results::Item.new :title => 'Test'
end
include ActiveModel::Lint::Tests
contex... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/configuration_test.rb | test/unit/configuration_test.rb | require 'test_helper'
module Tire
class ConfigurationTest < Test::Unit::TestCase
def teardown
Tire::Configuration.reset
ENV['ELASTICSEARCH_URL'] = nil
end
context "Configuration" do
setup do
Configuration.instance_variable_set(:@url, nil)
Configuration.instance_var... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/search_scan_test.rb | test/unit/search_scan_test.rb | require 'test_helper'
module Tire
module Search
class ScanTest < Test::Unit::TestCase
context "Scan" do
setup do
Configuration.reset
@results = {
"_scroll_id" => "abc123",
"took" => 3,
"hits" => {
"total" => 10,
"h... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/suggest_test.rb | test/unit/suggest_test.rb | require 'test_helper'
module Tire
class SuggestTest < Test::Unit::TestCase
context "Suggest" do
setup { Configuration.reset }
should "be initialized with single index" do
s = Suggest::Suggest.new('index') do
suggestion 'default-suggestion' do
text 'foo'
... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/search_facet_test.rb | test/unit/search_facet_test.rb | require 'test_helper'
module Tire::Search
class FacetTest < Test::Unit::TestCase
context "Facet" do
should "be serialized to JSON" do
assert_respond_to Facet.new('foo'), :to_json
end
context "generally" do
should "encode facets with defaults for current query" do
... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/search_highlight_test.rb | test/unit/search_highlight_test.rb | require 'test_helper'
module Tire::Search
class HighlightTest < Test::Unit::TestCase
context "Highlight" do
should "be serialized to JSON" do
assert_respond_to Highlight.new(:body), :to_json
end
should "specify highlight for single field" do
assert_equal( {:fields => { :body... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/model_persistence_test.rb | test/unit/model_persistence_test.rb | require 'test_helper'
module Tire
module Model
class PersistenceTest < Test::Unit::TestCase
context "Model" do
should "have default index name" do
assert_equal 'persistent_articles', PersistentArticle.index_name
assert_equal 'persistent_articles', PersistentArticle.new(:title... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/rubyext_test.rb | test/unit/rubyext_test.rb | require 'test_helper'
module Tire
class RubyCoreExtensionsTest < Test::Unit::TestCase
context "Hash" do
context "with no to_json method provided" do
setup do
@hash = { :one => 1}
# Undefine the `to_json` method...
::Hash.class_eval { remove_method(:to_json) rescue ... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/search_query_test.rb | test/unit/search_query_test.rb | require 'test_helper'
module Tire::Search
class QueryTest < Test::Unit::TestCase
context "Query" do
should "be serialized to JSON" do
assert_respond_to Query.new, :to_json
end
should "return itself as a Hash" do
assert_respond_to Query.new, :to_hash
assert_equal( { :t... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/test/unit/multi_search_test.rb | test/unit/multi_search_test.rb | require 'test_helper'
module Tire
class MultiSearchTest < Test::Unit::TestCase
context "Multi::Search" do
setup { Configuration.reset }
should "be initialized with index" do
@search = Tire::Search::Multi::Search.new 'foo'
assert_equal ['foo'], @search.indices
end
contex... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/examples/tire-dsl.rb | examples/tire-dsl.rb | # encoding: UTF-8
#
# **Tire** provides rich and comfortable Ruby API for the
# [_Elasticsearch_](http://www.elasticsearch.org/) search engine/database.
#
# _Elasticsearch_ is a scalable, distributed, cloud-ready, highly-available
# full-text search engine and database, communicating by JSON over RESTful HTTP,
# based ... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | true |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/examples/rails-application-template.rb | examples/rails-application-template.rb | # ===================================================================================================================
# Template for generating a no-frills Rails application with support for Elasticsearch full-text search via Tire
# =======================================================================================... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire.rb | lib/tire.rb | require 'rest_client'
require 'multi_json'
require 'active_model'
require 'hashr'
require 'cgi'
require 'active_support/core_ext/object/to_param'
require 'active_support/core_ext/object/to_query'
require 'active_support/core_ext/hash/except'
require 'active_support/json'
# Ruby 1.8 compatibility
require 'tire/rubyext... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/version.rb | lib/tire/version.rb | module Tire
VERSION = "0.6.2"
CHANGELOG =<<-END
IMPORTANT CHANGES LATELY:
19e524c [ACTIVEMODEL] Exposed the response from `MyModel#.update_index` as the `response` method on return value
bfcde21 [#916] Added support for the Suggest API (@marc-villanueva)
710451d [#857] Added support for the Sugg... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/count.rb | lib/tire/count.rb | module Tire
module Search
class CountRequestFailed < StandardError; end
class Count
attr_reader :indices, :types, :query, :response, :json
def initialize(indices=nil, options={}, &block)
@indices = Array(indices)
@types = Array(options.delete(:type)).map { |type| Utils.escape(... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/logger.rb | lib/tire/logger.rb | module Tire
class Logger
def initialize(device, options={})
@device = if device.respond_to?(:write)
device
else
File.open(device, 'a')
end
@device.sync = true if @device.respond_to?(:sync)
@options = options
# at_exit { @device.close unless @device.closed? } if... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/index.rb | lib/tire/index.rb | module Tire
class Index
SUPPORTED_META_PARAMS_FOR_BULK = [:_routing, :_ttl, :_version, :_version_type, :_percolate, :_parent, :_timestamp]
attr_reader :name, :response
def initialize(name, &block)
@name = name
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
en... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/delete_by_query.rb | lib/tire/delete_by_query.rb | module Tire
class DeleteByQuery
class DeleteByQueryRequestFailed < StandardError; end
attr_reader :indices, :types, :query, :response, :json
def initialize(indices=nil, options={}, &block)
@indices = Array(indices)
@types = Array(options[:type]).flatten
@options = options
if b... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/utils.rb | lib/tire/utils.rb | require 'uri'
module Tire
module Utils
def escape(s)
URI.encode_www_form_component(s.to_s)
end
def unescape(s)
s = s.to_s.respond_to?(:force_encoding) ? s.to_s.force_encoding(Encoding::UTF_8) : s.to_s
URI.decode_www_form_component(s)
end
extend self
end
end
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/search.rb | lib/tire/search.rb | module Tire
module Search
class SearchRequestFailed < StandardError; end
class Search
attr_reader :indices, :types, :query, :facets, :filters, :options, :explain, :script_fields
def initialize(indices=nil, options={}, &block)
if indices.is_a?(Hash)
set_indices_options(indices)... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/dsl.rb | lib/tire/dsl.rb | module Tire
module DSL
def configure(&block)
Configuration.class_eval(&block)
end
def search(indices=nil, params={}, &block)
if block_given?
Search::Search.new(indices, params, &block)
else
raise ArgumentError, "Please pass a Ruby Hash or an object with `to_hash` method... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/configuration.rb | lib/tire/configuration.rb | module Tire
class Configuration
def self.url(value=nil)
@url = (value ? value.to_s.gsub(%r|/*$|, '') : nil) || @url || ENV['ELASTICSEARCH_URL'] || "http://localhost:9200"
end
def self.client(klass=nil)
@client = klass || @client || HTTP::Client::RestClient
end
def self.wrapper(klas... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/multi_search.rb | lib/tire/multi_search.rb | module Tire
module Search
module Multi
# Wraps the search definitions for Tire::Multi::Search
#
class SearchDefinitions
include Enumerable
attr_reader :names
def initialize
@names = []
@searches = []
end
def << value
@... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/tasks.rb | lib/tire/tasks.rb | require 'rake'
require 'ansi/progressbar'
module Tire
module Tasks
module Import
def delete_index(index)
puts "[IMPORT] Deleting index '#{index.name}'"
index.delete
end
def create_index(index, klass)
unless index.exists?
mapping = MultiJson.encode(klass.tire.... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/alias.rb | lib/tire/alias.rb | module Tire
# Represents an *alias* in _Elasticsearch_. An alias may point to one or multiple
# indices, for instance to separate physical indices into logical entities, where
# each user has a "virtual index" or for setting up "sliding window" scenarios.
#
# See: http://www.elasticsearch.org/guide/reference... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/suggest.rb | lib/tire/suggest.rb | module Tire
module Suggest
class SuggestRequestFailed < StandardError; end
class Suggest
attr_reader :indices, :suggestion, :options
def initialize(indices=nil, options={}, &block)
if indices.is_a?(Hash)
@indices = indices.keys
else
@indices = Array(indices)
... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/rubyext/ruby_1_8.rb | lib/tire/rubyext/ruby_1_8.rb | require 'tire/rubyext/uri_escape' unless defined?(URI.encode_www_form_component) && defined?(URI.decode_www_form_component)
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/rubyext/uri_escape.rb | lib/tire/rubyext/uri_escape.rb | # Steal the URI escape/unescape compatibility layer from Rack
#
# See <http://www.ruby-doc.org/stdlib-1.9.3/libdoc/uri/rdoc/URI.html#method-c-encode_www_form_component>
# :stopdoc:
# Stolen from ruby core's uri/common.rb, with modifications to support 1.8.x
#
# https://github.com/ruby/ruby/blob/trunk/lib/uri/common.r... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/rubyext/hash.rb | lib/tire/rubyext/hash.rb | class Hash
def to_json(options=nil)
MultiJson.encode(self)
end unless respond_to?(:to_json)
alias_method :to_indexed_json, :to_json
end
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/rubyext/symbol.rb | lib/tire/rubyext/symbol.rb | # ActiveModel::Serialization Ruby < 1.9.x compatibility
class Symbol
def <=> other
self.to_s <=> other.to_s
end unless method_defined?(:'<=>')
def capitalize
to_s.capitalize
end unless method_defined?(:capitalize)
end
| ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/model/persistence.rb | lib/tire/model/persistence.rb | module Tire
module Model
# Allows to use _Elasticsearch_ as a primary database (storage).
#
# Contains all the `Tire::Model::Search` features and provides
# an [_ActiveModel_](http://rubygems.org/gems/activemodel)-compatible
# interface for persistance.
#
# Usage:
#
# class Ar... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/model/indexing.rb | lib/tire/model/indexing.rb | module Tire
module Model
# Contains logic for definition of index settings and mappings.
#
module Indexing
module ClassMethods
# Define [_settings_](http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html)
# for the corresponding index, such as number of s... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/model/callbacks.rb | lib/tire/model/callbacks.rb | module Tire
module Model
# Main module containing the infrastructure for automatic updating
# of the _Elasticsearch_ index on model instance create, update or delete.
#
# Include it in your model: `include Tire::Model::Callbacks`
#
# The model must respond to `after_save` and `after_destroy` ... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/model/search.rb | lib/tire/model/search.rb | module Tire
module Model
# Main module containing the search infrastructure for ActiveModel classes.
#
# By including this module, you'll provide the model with facilities to
# perform searches against index, define index settings and mappings,
# access the index object, etc.
#
# All the ... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/model/percolate.rb | lib/tire/model/percolate.rb | module Tire
module Model
# Contains support for the [percolation](http://www.elasticsearch.org/guide/reference/api/percolate.html)
# feature of _Elasticsearch_.
#
module Percolate
module ClassMethods
# Set up the percolation when documents are being added to the index.
#
... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/model/import.rb | lib/tire/model/import.rb | module Tire
module Model
# Provides support for efficient and effective importing of large recordsets into Elasticsearch.
#
# Tire will use dedicated strategies for fetching records in batches when ActiveRecord or Mongoid models are detected.
#
# Two dedicated strategies for popular pagination li... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/model/suggest.rb | lib/tire/model/suggest.rb | module Tire
module Model
module Suggest
module ClassMethods
def suggest(*args, &block)
default_options = {:type => document_type, :index => index.name}
if block_given?
options = args.shift || {}
else
query, options = args
options ||=... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/model/naming.rb | lib/tire/model/naming.rb | module Tire
module Model
# Contains logic for getting and setting the index name and document type for this model.
#
module Naming
module ClassMethods
# Get or set the index name for this model, based on arguments.
#
# By default, uses ActiveSupport inflection, so a class ... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/model/persistence/attributes.rb | lib/tire/model/persistence/attributes.rb | module Tire
module Model
module Persistence
# Provides infrastructure for declaring the model properties and accessing them.
#
module Attributes
module ClassMethods
# Define property of the model:
#
# class Article
# include Tire::Model... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/model/persistence/storage.rb | lib/tire/model/persistence/storage.rb | module Tire
module Model
module Persistence
# Provides infrastructure for storing records in _Elasticsearch_.
#
module Storage
def self.included(base)
base.class_eval do
extend ClassMethods
include InstanceMethods
end
end
mo... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/model/persistence/finders.rb | lib/tire/model/persistence/finders.rb | module Tire
module Model
module Persistence
# Provides infrastructure for an _ActiveRecord_-like interface for finding records.
#
module Finders
module ClassMethods
def find *args
# TODO: Options like `sort`
options = args.pop if args.last.is_a?(Hash... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/suggest/suggestion.rb | lib/tire/suggest/suggestion.rb | module Tire
module Suggest
class Suggestion
attr_accessor :value, :name
def initialize(name, &block)
@name = name
@value = {}
block.arity < 1 ? self.instance_eval(&block) : block.call(self) if block_given?
end
def text(value)
@value[:text] = value
... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/results/collection.rb | lib/tire/results/collection.rb | module Tire
module Results
class Collection
include Enumerable
include Pagination
attr_reader :time, :total, :options, :facets, :max_score, :suggestions
def initialize(response, options={})
@response = response
@options = options
@time = response['t... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/results/item.rb | lib/tire/results/item.rb | module Tire
module Results
class Item
extend ActiveModel::Naming
include ActiveModel::Conversion
# Create new instance, recursively converting all Hashes to Item
# and leaving everything else alone.
#
def initialize(args={})
raise ArgumentError, "Please pass a Hash-l... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/results/suggestions.rb | lib/tire/results/suggestions.rb | module Tire
module Results
class Suggestions
include Enumerable
def initialize(response, options={})
@response = response
@options = options
@shards_info ||= @response.delete '_shards'
@keys ||= @response.keys
end
def results
return [] if failure?
... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/results/pagination.rb | lib/tire/results/pagination.rb | module Tire
module Results
# Adds support for WillPaginate and Kaminari
#
module Pagination
def default_per_page
10
end
module_function :default_per_page
def total_entries
@total
end
def per_page
(@options[:per_page] || @options[:size] || def... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/search/filter.rb | lib/tire/search/filter.rb | module Tire
module Search
# http://www.elasticsearch.org/guide/reference/api/search/filter.html
# http://www.elasticsearch.org/guide/reference/query-dsl/
#
class Filter
def initialize(type, *options)
value = if options.size < 2
options.first || {}
else
optio... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/search/sort.rb | lib/tire/search/sort.rb | module Tire
module Search
class Sort
def initialize(&block)
@value = []
block.arity < 1 ? self.instance_eval(&block) : block.call(self) if block_given?
end
def by(name, direction=nil)
@value << ( direction ? { name => direction } : name )
self
end
d... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/search/query.rb | lib/tire/search/query.rb | module Tire
module Search
class Query
attr_accessor :value
def initialize(&block)
@value = {}
block.arity < 1 ? self.instance_eval(&block) : block.call(self) if block_given?
end
def term(field, value, options={})
query = if value.is_a?(Hash)
{ field => ... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/search/facet.rb | lib/tire/search/facet.rb | module Tire
module Search
class Facet
def initialize(name, options={}, &block)
@name = name
@options = options
@value = {}
block.arity < 1 ? self.instance_eval(&block) : block.call(self) if block_given?
end
def terms(field, options={})
size = ... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/search/scan.rb | lib/tire/search/scan.rb | module Tire
module Search
# Performs a "scan/scroll" search request, which obtains a `scroll_id`
# and keeps returning documents matching the passed query (or all documents) in batches.
#
# You may want to iterate over the batches being returned:
#
# search = Tire::Search::Scan.new('arti... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/search/highlight.rb | lib/tire/search/highlight.rb | module Tire
module Search
# http://www.elasticsearch.org/guide/reference/api/search/highlighting.html
#
class Highlight
def initialize(*args)
@options = (args.last.is_a?(Hash) && args.last.delete(:options)) || {}
extract_highlight_tags
@fields = args.inject({}) do |resul... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/search/script_field.rb | lib/tire/search/script_field.rb | module Tire
module Search
# http://www.elasticsearch.org/guide/reference/api/search/script-fields.html
# http://www.elasticsearch.org/guide/reference/modules/scripting.html
class ScriptField
def initialize(name, options)
@hash = { name => options }
end
def to_json(options={})... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/search/queries/custom_filters_score.rb | lib/tire/search/queries/custom_filters_score.rb | module Tire
module Search
# Custom Filters Score
# ==============
#
# Author: Jerry Luk <jerryluk@gmail.com>
#
#
# Adds support for "custom_filters_score" queries in Tire DSL.
#
# It hooks into the Query class and inserts the custom_filters_score query types.
#
#
# Usa... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/search/queries/match.rb | lib/tire/search/queries/match.rb | module Tire
module Search
class Query
def match(field, value, options={})
if @value.empty?
@value = MatchQuery.new(field, value, options).to_hash
else
MatchQuery.add(self, field, value, options)
end
@value
end
end
class MatchQuery
def... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/http/response.rb | lib/tire/http/response.rb | module Tire
module HTTP
class Response
attr_reader :body, :code, :headers
def initialize(body, code, headers={})
@body, @code, @headers = body, code.to_i, headers
end
def success?
code > 0 && code < 400
end
def failure?
! success?
end
d... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/http/client.rb | lib/tire/http/client.rb | module Tire
module HTTP
module Client
class RestClient
ConnectionExceptions = [::RestClient::ServerBrokeConnection, ::RestClient::RequestTimeout]
def self.get(url, data=nil)
perform ::RestClient::Request.new(:method => :get, :url => url, :payload => data).execute
rescue... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/http/clients/faraday.rb | lib/tire/http/clients/faraday.rb | require 'faraday'
# A Faraday-based HTTP client, which allows you to choose a HTTP client.
#
# See <https://github.com/technoweenie/faraday/tree/master/lib/faraday/adapter>
#
# NOTE: Tire will switch to Faraday for the HTTP abstraction layer. This client is a temporary solution.
#
# Example:
# --------
#
# require... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
karmi/retire | https://github.com/karmi/retire/blob/1016449cd5bcfd52853f1728452e26962c18790e/lib/tire/http/clients/curb.rb | lib/tire/http/clients/curb.rb | require 'curb'
module Tire
module HTTP
module Client
class Curb
def self.client
Thread.current[:client] ||= begin
client = ::Curl::Easy.new
client.resolve_mode = :ipv4
# client.verbose = true
client
end
end
def ... | ruby | MIT | 1016449cd5bcfd52853f1728452e26962c18790e | 2026-01-04T16:00:24.294681Z | false |
AdoptOpenJDK/homebrew-openjdk | https://github.com/AdoptOpenJDK/homebrew-openjdk/blob/27915e4ab3856595a8b46d1fd3b6c379c1f02210/Casks/adoptopenjdk8-jre.rb | Casks/adoptopenjdk8-jre.rb | # PLEASE DO NOT EDIT THIS FILE. EDIT Templates/adoptopenjdk.rb.tmpl
cask "adoptopenjdk8-jre" do
version "8,292:b10"
sha256 "42a3a7992d46b6d1cf78e56eec11152411d194bbaff7035acde6d00eeb2cec68"
# github.com/AdoptOpenJDK was verified as official when first introduced to the cask
url "https://github.com/AdoptOpenJDK... | ruby | Apache-2.0 | 27915e4ab3856595a8b46d1fd3b6c379c1f02210 | 2026-01-04T16:00:44.802682Z | false |
AdoptOpenJDK/homebrew-openjdk | https://github.com/AdoptOpenJDK/homebrew-openjdk/blob/27915e4ab3856595a8b46d1fd3b6c379c1f02210/Casks/adoptopenjdk11-openj9.rb | Casks/adoptopenjdk11-openj9.rb | # PLEASE DO NOT EDIT THIS FILE. EDIT Templates/adoptopenjdk.rb.tmpl
cask "adoptopenjdk11-openj9" do
version "11.0.11,9"
sha256 "4e1cc6fbc050b4ea01aca8791726fd32ee979f737d4124f5f683a67223b55ba0"
# github.com/AdoptOpenJDK was verified as official when first introduced to the cask
url "https://github.com/AdoptOpe... | ruby | Apache-2.0 | 27915e4ab3856595a8b46d1fd3b6c379c1f02210 | 2026-01-04T16:00:44.802682Z | false |
AdoptOpenJDK/homebrew-openjdk | https://github.com/AdoptOpenJDK/homebrew-openjdk/blob/27915e4ab3856595a8b46d1fd3b6c379c1f02210/Casks/adoptopenjdk13.rb | Casks/adoptopenjdk13.rb | # PLEASE DO NOT EDIT THIS FILE. EDIT Templates/adoptopenjdk.rb.tmpl
cask "adoptopenjdk13" do
version "13.0.2,8"
sha256 "7b60830e61a0483ee81ed6ca6463e211a529e43b1f3815a57c2e3780ce4ba0ba"
# github.com/AdoptOpenJDK was verified as official when first introduced to the cask
url "https://github.com/AdoptOpenJDK/ope... | ruby | Apache-2.0 | 27915e4ab3856595a8b46d1fd3b6c379c1f02210 | 2026-01-04T16:00:44.802682Z | false |
AdoptOpenJDK/homebrew-openjdk | https://github.com/AdoptOpenJDK/homebrew-openjdk/blob/27915e4ab3856595a8b46d1fd3b6c379c1f02210/Casks/adoptopenjdk9.rb | Casks/adoptopenjdk9.rb | cask "adoptopenjdk9" do
version "9,181"
sha256 "bbe348baab3cca097b77f7fff6c8465858e642ad42c5851bde33a1553ca12653"
# github.com/AdoptOpenJDK was verified as official when first introduced to the cask
url "https://github.com/AdoptOpenJDK/openjdk#{version.csv.first}-binaries/releases/download/jdk-#{version.csv.fi... | ruby | Apache-2.0 | 27915e4ab3856595a8b46d1fd3b6c379c1f02210 | 2026-01-04T16:00:44.802682Z | false |
AdoptOpenJDK/homebrew-openjdk | https://github.com/AdoptOpenJDK/homebrew-openjdk/blob/27915e4ab3856595a8b46d1fd3b6c379c1f02210/Casks/adoptopenjdk10.rb | Casks/adoptopenjdk10.rb | cask "adoptopenjdk10" do
version "10,0.2:13"
sha256 "550fac840563073dcfaa1ffd4a3a9cc68fd8ccc71bbc65baf3cb32ec734c30dd"
# github.com/AdoptOpenJDK was verified as official when first introduced to the cask
url "https://github.com/AdoptOpenJDK/openjdk#{version.major}-binaries/releases/download/jdk-10.0.2%2B13.1/O... | ruby | Apache-2.0 | 27915e4ab3856595a8b46d1fd3b6c379c1f02210 | 2026-01-04T16:00:44.802682Z | false |
AdoptOpenJDK/homebrew-openjdk | https://github.com/AdoptOpenJDK/homebrew-openjdk/blob/27915e4ab3856595a8b46d1fd3b6c379c1f02210/Casks/adoptopenjdk14-openj9-jre.rb | Casks/adoptopenjdk14-openj9-jre.rb | # PLEASE DO NOT EDIT THIS FILE. EDIT Templates/adoptopenjdk.rb.tmpl
cask "adoptopenjdk14-openj9-jre" do
version "14.0.2,12"
sha256 "5e7a2770592b1f6d6138d6ed020b487f508b1562f30c6ba789cda836726bba51"
# github.com/AdoptOpenJDK was verified as official when first introduced to the cask
url "https://github.com/Adop... | ruby | Apache-2.0 | 27915e4ab3856595a8b46d1fd3b6c379c1f02210 | 2026-01-04T16:00:44.802682Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.