Created
October 26, 2011 06:29
-
-
Save floere/1315618 to your computer and use it in GitHub Desktop.
Running Picky e.g. in a single script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Possible since Picky 3.2.0. | |
# | |
require 'picky' | |
include Picky | |
Thing = Struct.new :id, :name | |
index = Index.new :test do | |
category :name, similarity: Similarity::DoubleMetaphone.new(3) | |
end | |
index.replace Thing.new(1, 'Picky') | |
index.replace Thing.new(2, 'Parslet') | |
things = Search.new(index) do | |
boost [:name] => +3 | |
end | |
p things.search("Pick").ids | |
p things.search("Pic").to_hash | |
p things.search("Parsley~").allocations |
Author
floere
commented
Oct 27, 2011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment