Google Groups

Re: [picky:110] facets?


Picky / Florian Hanke Jul 23, 2012 6:56 PM
Posted in group: Picky-Ruby
On Tuesday, 24 July 2012 11:44:42 UTC+10, David Lowenfels wrote:
On Jul 23, 2012, at 5:31 PM, Picky / Florian Hanke wrote:
>  Facets (as I added them in in 4.5.9+) use the indexed weights instead of the ids sizes.
> Also see https://github.com/floere/picky/blob/master/history.textile (4.5.9) for details.

> Product.class_eval("@@products_search").facets(:gender)
 => {"women"=>8.899, "men"=>8.76}

how do I convert this from weights to numbers? Weights don't seem to be very useful to me as an end user…
or do I need to use the code I was using previously to do the sub filter? (see bottom of message)

You are right. (Yes, for now, please use the old code to override the Picky code).

I'm currently unsure how to proceed. Using the size is important for the end user. Weight however is important to sort.

Perhaps it should use the size – it's clearer to the end user. One big problem: Returning the correct size in a filtered query is far more complicated than what we're doing already. We're talking adding new indexes to Picky, and I'm not sure I want to go there. Yet.

I need to think more deeply about this – sorry about that.
 
> Product.class_eval("@@products_search").facets(:gender, filter:"climbing jacket")
 => {}
why am I getting an empty hash for this? I was expecting this would give me the same as my previous code.

I'll have to look into it tomorrow morning – my time is very limited at the moment.

Perhaps, for now, it is best to go back to your code until the Picky code gets more refined?
 
> Picky::Search#search has the signature:
> def search text, ids = 20, offset = 0, options = {}
> If you pass in unique: true in the options, it will return unique results. It will be unique top down. That is, id an id has been used for one allocation of categories, eg. [:name, :surname], it will not be used anymore in a following allocation.
okay. I never saw this before because I didn't dig into the code.
shouldn't this method be explained on http://florianhanke.com/picky/documentation.html ?
even in the rdoc there is no mention of options[:unique]

Good point – I updated the documentation. Thanks!

Sorry I can't be more helpful at the moment. I hope you can understand. If all fails, perhaps you could switch to a more advanced (in years/development) search engine?

Cheers,
   Florian