Sha256: c1f6ac632172076a9d3d39fc3378ce733c03ba6d8cade871f77dc1b229fdb6e7
Contents?: true
Size: 966 Bytes
Versions: 15
Compression:
Stored size: 966 Bytes
Contents
# encoding: utf-8 # require 'spec_helper' require 'ostruct' describe "Array IDs" do let(:index) { Picky::Index.new :arrays } let(:try) { Picky::Search.new index } # This tests the weights option. # it 'can use Arrays as IDs' do index.category :text1 thing = OpenStruct.new id: ['id1', 'thing1'], text1: "ohai" other = OpenStruct.new id: ['id2', 'thing2'], text1: "ohai kthxbye" index.add thing index.add other try.search("text1:ohai").ids.should == [ ["id2", "thing2"], ["id1", "thing1"] ] end # This tests the weights option. # it 'can use split as key_format' do index.key_format :split index.category :text1 thing = OpenStruct.new id: "id1 thing1", text1: "ohai" other = OpenStruct.new id: "id2 thing2", text1: "ohai kthxbye" index.add thing index.add other try.search("text1:ohai").ids.should == [ ["id2", "thing2"], ["id1", "thing1"] ] end end
Version data entries
15 entries across 15 versions & 1 rubygems