Skip to content

Instantly share code, notes, and snippets.

@floere
Created November 9, 2012 11:02
Show Gist options
  • Save floere/4045154 to your computer and use it in GitHub Desktop.
Save floere/4045154 to your computer and use it in GitHub Desktop.
Picky basic script example
require 'picky'
Person = Struct.new :id, :age, :name
data = Picky::Index.new :people do
category :age, partial: Picky::Partial::None.new
category :name
end
data.replace Person.new(1, 34, 'Florian')
data.replace Person.new(2, 77, 'Floris')
people = Picky::Search.new data
results = people.search '34 flori' # Takes around 0.0001s
p results # For logging
p results.allocations # => Returns ids, weight etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment