Skip to content

Instantly share code, notes, and snippets.

@beatrichartz
Last active December 19, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beatrichartz/5968572 to your computer and use it in GitHub Desktop.
Save beatrichartz/5968572 to your computer and use it in GitHub Desktop.
Picky Bug Report
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}
@floere
Copy link

floere commented Jul 11, 2013

What if you search for

shoes_search.facets(:color, filter: 'color:black') # => {"black"=>1}
shoes_search.facets(:color, filter: 'name:black') # => {"black"=>1}

?

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.

@floere
Copy link

floere commented Jul 11, 2013

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