Sha256: f583852d3dc917eba866f4e7e74302412b2686d341f2aa50540f7bf9556edd83

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'acceptance/spec_helper'

describe '64 bit integer support' do
  it "ensures all internal id attributes are big ints if one is" do
    large_index = ThinkingSphinx::ActiveRecord::Index.new(:tweet)
    large_index.definition_block = Proc.new {
      indexes text
    }

    small_index = ThinkingSphinx::ActiveRecord::Index.new(:article)
    small_index.definition_block = Proc.new {
      indexes title
    }

    ThinkingSphinx::Configuration::ConsistentIds.new(
      [small_index, large_index]
    ).reconcile

    large_index.sources.first.attributes.detect { |attribute|
      attribute.name == 'sphinx_internal_id'
    }.type.should == :bigint

    small_index.sources.first.attributes.detect { |attribute|
      attribute.name == 'sphinx_internal_id'
    }.type.should == :bigint
  end
end

describe '64 bit document ids', :live => true do
  it 'handles large 32 bit integers with an offset multiplier' do
    user = User.create! :name => 'Pat'
    user.update_column :id, 980190962

    index

    expect(User.search('pat').to_a).to eq([user])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinking-sphinx-3.1.2 spec/acceptance/big_integers_spec.rb