Sha256: 7b80db1ff280342434d46ef94133f639447acfa362b7c4dbb3b3579c85b9a7be
Contents?: true
Size: 823 Bytes
Versions: 2
Compression:
Stored size: 823 Bytes
Contents
# encoding: utf-8 # require 'spec_helper' describe "Weights" do # This tests the weights option. # it 'can handle dynamic weights' do index = Picky::Index.new :exact_first do source { [] } category :text, partial: Picky::Partial::Substring.new(from: 1) end require 'ostruct' exact = OpenStruct.new id: 1, text: "disco" partial = OpenStruct.new id: 2, text: "discofox" index.add exact index.add partial normal = Picky::Search.new index normal.search("disco").ids.should == [2, 1] # 2 was added later. index = Picky::Wrappers::Category::ExactFirst.wrap index exact_first = Picky::Search.new index exact_first.search("disco").ids.should == [1, 2] # Exact first. exact_first.search("disc").ids.should == [2, 1] # Not exact, so not first. end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
picky-3.6.7 | spec/specific/exact_first_spec.rb |
picky-3.6.6 | spec/specific/exact_first_spec.rb |