Sha256: 96a60a01505dca23e205480e688903eecf2047bd8da0110e3eb6bb038bdbdb13

Contents?: true

Size: 937 Bytes

Versions: 63

Compression:

Stored size: 937 Bytes

Contents

# encoding: utf-8
#
require 'spec_helper'

describe "Realtime Indexing" do

  ReloadingBook = Struct.new(:id, :title, :author)

  context 'default index' do
    let(:index) do
      Picky::Index.new(:books) do
        category :title
        category :author, similarity: Picky::Generators::Similarity::DoubleMetaphone.new(3)
      end
    end
    let(:books) { Picky::Search.new index }

    before(:each) do
      index.add ReloadingBook.new(1, "Title", "Author")
    end

    context 'dumping and loading' do
      it "doesn't find books anymore after dumping and loading and updating" do
        index.replace ReloadingBook.new(2, "Title New", "Author New")

        books.search("title").ids.should == [2, 1]

        index.dump
        index.load
        index.build_realtime_mapping

        index.replace ReloadingBook.new(2, "Blah New", "Author New")

        books.search("title").ids.should == [1]
      end
    end
  end

end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
picky-4.31.3 spec/functional/reloading_spec.rb
picky-4.31.2 spec/functional/reloading_spec.rb
picky-4.31.1 spec/functional/reloading_spec.rb
picky-4.31.0 spec/functional/reloading_spec.rb
picky-4.30.0 spec/functional/reloading_spec.rb
picky-4.29.0 spec/functional/reloading_spec.rb
picky-4.28.1 spec/functional/reloading_spec.rb
picky-4.27.1 spec/functional/reloading_spec.rb
picky-4.27.0 spec/functional/reloading_spec.rb
picky-4.26.2 spec/functional/reloading_spec.rb
picky-4.26.1 spec/functional/reloading_spec.rb
picky-4.26.0 spec/functional/reloading_spec.rb
picky-4.25.3 spec/functional/reloading_spec.rb
picky-4.25.2 spec/functional/reloading_spec.rb
picky-4.25.1 spec/functional/reloading_spec.rb
picky-4.25.0 spec/functional/reloading_spec.rb
picky-4.24.0 spec/functional/reloading_spec.rb
picky-4.23.2 spec/functional/reloading_spec.rb
picky-4.23.1 spec/functional/reloading_spec.rb
picky-4.23.0 spec/functional/reloading_spec.rb