You could use a regular ActiveRecord::Base#find to get the distinct
product ids.  I think Pat mentioned this.

You can also do a group by with Thinking Sphinx.  I believe it will
probably still query your database though.  It would be nice if there
was something similar to search_for_ids that would allow you to choose
which id to return (not just he pk).

James

On Nov 3, 8:19 am, Alan <[email protected]> wrote:
> Hi Pat, I have implemented your suggestion, but not sure if you have
> some ideas to deal with this issue....
>
> Say that I have a 400 products, each with about 20 shoe options(size/
> color/width combinations). What I end up getting from the first search
> is capped at 1000 results(I'm guessing this is a built in TS cap).
> Ignoring the cap for now, what I really want to do is return the
> distinct product ids from those shoe options so I can then run the
> appropriate Product search(where I have at most say a 100 ids vs
> consistently a 1000).  I've hacked the facet search so that I can
> return ids, but not sure if there is an easy way to return distinct
> attributes, in this case it being product_ids of shoe options.
>
> On Oct 30, 7:59 pm, Pat Allan <[email protected]> wrote:
>
> > Although, you could add shoe_options(:id) as an attribute to your  
> > Product index, and then do a normal find for shoes that are brown and  
> > wide, then use the ids of those results in a filter while searching on  
> > Product...
>
> > Whether that's flexible enough for general use, though, is up to you.
>
> > --
> > Pat
>
> > On 31/10/2009, at 2:57 PM, Pat Allan wrote:
>
> > > Hi Alan
>
> > > There isn't really any easier ways to do what you're after... Sphinx
> > > has no understanding of key-value pairs, especially when it comes to
> > > fields, so I think your best bet is to search on ShoeOption instead.
>
> > > --
> > > Pat
>
> > > On 30/10/2009, at 7:22 AM, Alan wrote:
>
> > >> Wondering how best to handle the following situation:
>
> > >> Product has many Shoe_Option(example class name to illustrate type of
> > >> data model) where shoe options have the attributes of color, size and
> > >> width.
>
> > >> I want to do a search on products that have shoe options that have
> > >> "brown" for color and "wide" for width.
>
> > >> If I define index at the Product level(attempting to find products
> > >> with children that match), my result set of products is off, because
> > >> it will match products that might not have a child option that has
> > >> both brown AND wide.... It will simply match if there is a one child
> > >> shoe option with "wide" and at least one other child shoe option with
> > >> "brown".
>
> > >> What I am really looking for is an individual Shoe Option with BOTH  
> > >> of
> > >> these attributes.
>
> > >> Ok, so the obvious next thought would be to define the index at the
> > >> Shoe Option. That's great except, that it return a list of Shoe
> > >> Options, when I want products... Obviously I can manipulate the TS
> > >> result set, but I would like to do this at a lower level so there
> > >> isn't unnecessary processing.
>
> > >> Anyone have tips on how to do this with TS? Let me know if my example
> > >> is not clear...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to