Hi there

Sorry for the slow response.

If you want to sort on price, then there much only be one price value per 
Sphinx document - so, an approach that will work is searching on ProductWebsite 
instead, and have the index defined there looking something like this:

  define_index do
    indexes name, sku
    
    has status, :as => :status_attr
    has product.manufacturers_id, :as => :brand_id_attr, :facet => true
    has regular_price_ht, :as => :price
    has website_id, :as => :pw_website_id
  end

And then you'll get a collection of product websites returned, so handle those 
appropriately.

Cheers

-- 
Pat

On 19/06/2013, at 10:04 PM, kpitn wrote:

> Hi,
> 
> I want to sort result by price, but the result are mixed / strange.
> 
> I have Product and ProductWebsite
> Each product has a different sku / name / price on each website.
> 
> This is my define_index :
> 
>   define_index do
>     indexes product_websites.sku, :as => :sku
>     indexes product_websites.name, :as => :name
> 
>     has product_websites.status, :as => :status_attr
>     has manufacturers_id, :as => :brand_id_attr, :facet => true
>     has product_websites.regular_price_ht, :as=> :price
>     has product_websites.website_id, :as=> :pw_website_id
>   end
> 
> How can i handle sort on price ? The only way I search product is by website 
> but how can i do that ?
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  



-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to