Sha256: 2be3a5f715d5a05934f9055f9161bb48c28af409dd6f0a123e93b5734d8e1015

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

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'
    Product.search('Jekyll', :retry_stale => false).to_a.should == [jekyll]
    Product.search(:retry_stale => false).to_a.should == [jekyll]

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thinking-sphinx-3.2.0 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-3.1.4 spec/acceptance/searching_across_schemas_spec.rb
thinking-sphinx-3.1.3 spec/acceptance/searching_across_schemas_spec.rb