Thanks for the advice! That would solve the problem. We're using the permalink instead to avoid gathering subcategories recursively. I didn't measure the query times but I think this is faster than searching products for each subcategory - and the code looks much nicer.
Well, I think there's no way to make Sphinx use delta in a product search if changes only occured to the category names. This wouldn't be very efficient anyway as the delta index would have to be used in each product search then. We'll use our old code then... Best regards On 3 Jun., 04:54, Pat Allan <[email protected]> wrote: > It sounds like category is an association for Product. Why not filter > by the id instead, to ensure it's always correct? > define_index do > # ... > has category(:id), :as => :category_id > end > > Product.search :with => {:category_id => @category.id} > > -- > Pat > > On 02/06/2009, at 11:59 AM, tilt wrote: > > > > > Hi, > > > Is there a way to select an older version of a record even if I've > > activated the delta property? > > > We've got the following problem: > > > We'd like to select products filtered by a certain category using the > > permalink of the category. > > If the category name is updated and thus its permalink, the filtering > > Product.search :conditions => {:category => permalink} fails because > > the condition tries to match the former permalink of the category. > > Unfortunately Sphinx only uses the delta index of the model the query > > is perfomed on, e.g. "Product". > > > So if we can't tell Sphinx to use the delta index for categories > > although they only appear within the conditions we apply to search > > products, we'll have to tell Sphinx to look up the former category's > > name - ignoring the delta index. > > > Any ideas? > > > Thanks a lot!!! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en -~----------~----~----~----~------~----~------~--~---
