Last active
December 19, 2015 14:19
-
-
Save beatrichartz/5968572 to your computer and use it in GitHub Desktop.
Picky Bug Report
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
require 'picky' | |
Shoe = Struct.new(:id, :color, :name) | |
shoes_index = Picky::Index.new(:shoes) do | |
category :color | |
category :name | |
end | |
shoes_search = Picky::Search.new(shoes_index) | |
shoes_index.add Shoe.new(1, 'black', 'Outdoor Black') | |
shoes_search.facets(:color) #=> {'black' => 1} | |
shoes_search.facets(:color, filter: 'black') #=> {'black' => 2} |
Also: Thanks for the gist file – very helpful!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What if you search for
?
That's the reason the docs prefix a specific category for their filter:
http://pickyrb.com/documentation.html#search_facets
The idea is that you can filter against everything and that if you want to filter only on a specific category, you have to tell Picky to do so.