Sha256: 6f6cbc986c3723cfedb3d2e392c1cdaea6abd74cc15dc1932f95738b535d87fe

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

# encoding: utf-8
shared_context "search corpus setup" do
  before do
    @search_bucket = random_bucket 'search_test'
    @backend.create_search_index @search_bucket.name

    wait_until{ !@backend.get_search_index(@search_bucket.name).nil? }

    @client.set_bucket_props(@search_bucket,
                             {search_index: @search_bucket.name},
                             'yokozuna')

    wait_until do
      p = @client.get_bucket_props(@search_bucket, type: 'yokozuna')
      p['search_index'] == @search_bucket.name
    end

    idx = 0
    old_encoding = Encoding.default_external
    Encoding.default_external = Encoding::UTF_8
    IO.foreach("spec/fixtures/bitcask.txt") do |para|
      next if para =~ /^\s*$|introduction|chapter/ui
      idx += 1
      Riak::RObject.new(@search_bucket, "bitcask-#{idx}") do |obj|
        obj.content_type = 'text/plain'
        obj.raw_data = para
        @backend.store_object(obj, type: 'yokozuna')
      end
    end
    Encoding.default_external = old_encoding
    
    wait_until do
      results = @backend.search(@search_bucket.name, 
                                'contain your entire keyspace',
                                df: 'text')
      results['docs'].length > 0
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
riak-client-2.2.0.pre1 spec/support/search_corpus_setup.rb
riak-client-2.1.0 spec/support/search_corpus_setup.rb
riak-client-2.0.0 spec/support/search_corpus_setup.rb
riak-client-2.0.0.rc2 spec/support/search_corpus_setup.rb
riak-client-2.0.0.rc1 spec/support/search_corpus_setup.rb