Sha256: 2d4978a8fa8c9180443ac10e0ca0d64e96723e5f5905f478d5dd87f4b086e2ab

Contents?: true

Size: 1.44 KB

Versions: 17

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

require 'acceptance/spec_helper'

multi_schema = MultiSchema.new

describe 'Searching across PostgreSQL schemas', :live => true do
  before :each do
    ThinkingSphinx::Configuration.instance.index_set_class =
      MultiSchema::IndexSet
  end

  after :each do
    ThinkingSphinx::Configuration.instance.index_set_class = nil
    multi_schema.switch :public
  end

  it 'can distinguish between objects with the same primary key' do
    multi_schema.switch :public
    jekyll = Product.create name: 'Doctor Jekyll'
    expect(Product.search('Jekyll', :retry_stale => false).to_a).to eq([jekyll])
    expect(Product.search(:retry_stale => false).to_a).to eq([jekyll])

    multi_schema.switch :thinking_sphinx
    hyde = Product.create name: 'Mister Hyde'
    expect(Product.search('Jekyll', :retry_stale => false).to_a).to eq([])
    expect(Product.search('Hyde', :retry_stale => false).to_a).to eq([hyde])
    expect(Product.search(:retry_stale => false).to_a).to eq([hyde])

    multi_schema.switch :public
    expect(Product.search('Jekyll', :retry_stale => false).to_a).to eq([jekyll])
    expect(Product.search(:retry_stale => false).to_a).to eq([jekyll])
    expect(Product.search('Hyde', :retry_stale => false).to_a).to eq([])

    expect(Product.search(
      :middleware => ThinkingSphinx::Middlewares::RAW_ONLY,
      :indices    => ['product_core', 'product_two_core']
    ).to_a.length).to eq(2)
  end
end if multi_schema.active?

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-5.5.1 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-5.5.0 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-5.4.0 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-5.3.0 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-5.2.1 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-5.2.0 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-5.1.0 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-5.0.0 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-4.4.1 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-4.4.0 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-4.3.2 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-4.3.1 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-4.3.0 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-4.2.0 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-4.1.0 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-4.0.0 spec/acceptance/searching_across_schemas_spec.rb