Google Groups

Re: [picky:118] facets?


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

Thanks for trying! Which version were you using?

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??
Not sure either. Maybe because I've rewritten the code to not search partially on the last token.

That is:
Instead of searching (implicitly) for "climbing jacket*" I now search for "climbing jacket". The assumption here is that facets are usually used on an enumeration of "subcategories".

But atm I can only guess. Hope to look into it soon.
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.
That is curious.

So Products.facets(:gender, filter: 'keywords:climbing jacket') returns a result, but Products.facets(:gender, 'climbing jacket') does not? (Is Products.facets your code or Picky's?)
i.e. this is the result of my previous code which works by subqueries:
Product.facet(:gender, "climbing jacket")
=> [["women", 9], ["men", 19]]
Thanks!

Cheers,
   Florian