Google Groups

Re: [picky:118] facets?


Picky / Florian Hanke Jul 25, 2012 12:43 AM
Posted in group: Picky-Ruby
Hi David,

I just tried to reproduce your results.

Running

p products.facets :gender
p products.facets :gender, filter: 'keywords:climbing jacket'
p products.facets :gender, filter: 'climbing jacket'

with your data yields me

{"women"=>7324, "men"=>6372}
{"women"=>10, "men"=>47}
{"women"=>10, "men"=>47}

I'm using the latest Picky::Search#facets code.

Does that help/look ok somehow?

Cheers,
   Florian

On Wednesday, 25. July 2012 at 17:14, David Lowenfels wrote:

Product.facets(:gender)
=> {"women"=>7324, "men"=>6372}
Product.facets(:gender, filter:"climbing jacket")
=> {}
not sure why I'm getting an empty hash here??

Product.facets(:gender, filter:"keywords:climbing jacket")
=> {"women"=>4, "men"=>17}
it only works when I specify the category to filter, but there are other matches which come on a more global query when not scoped by category.
i.e. this is the result of my previous code which works by subqueries:
Product.facet(:gender, "climbing jacket")
=> [["women", 9], ["men", 19]]