Skip to content

Commit

Permalink
+ Make the logarithmic spec a bit more complicated
Browse files Browse the repository at this point in the history
  • Loading branch information
floere committed Nov 13, 2011
1 parent c783dbd commit 77fa1b3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions server/spec/specific/dynamic_weights_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@
require 'ostruct'

thing = OpenStruct.new id: 1, text1: "ohai", text2: "hello", text3: "world", text4: "kthxbye"
other = OpenStruct.new id: 2, text1: "", text2: "", text3: "", text4: "kthxbye"

index.add thing
index.add other

try = Picky::Search.new index

try.search("text1:ohai").allocations.first.score.should == 0.0
try.search("text2:hello").allocations.first.score.should == 3.14
try.search("text3:world").allocations.first.score.should == 5
try.search("text4:kthxbye").allocations.first.score.should == 0
try.search("text1:ohai").allocations.first.score.should == 0.0
try.search("text2:hello").allocations.first.score.should == 3.14
try.search("text3:world").allocations.first.score.should == 5
try.search("text4:kthxbye").allocations.first.score.should == 0.6931471805599453
end
end

Expand Down

0 comments on commit 77fa1b3

Please sign in to comment.