I think the first thing to be aware of is that you're trying to sort by a set of values - each category can have multiple client categories - so handling that from either a Sphinx or SQL perspective isn't a simple matter. What do you expect to happen if a category has three different client category positions? Which one should be considered the value to sort by?
--
Pat
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/S44OFcKXDIAJ.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
Can a category be assigned to different clients?
--
Pat
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/3vcyf4_IzZwJ.
I think running the search from the ClientCategory model will be much better, as that gives you single values of group and position, you can pull in the category name easily enough, and you can add an attribute for the client_id and filter by that. If it's running particularly slow, do you have database indices set up on your foreign keys? And how slow is slow, and how many records?
Cheers
--
Pat
On 19/06/2012, at 12:43 PM, mikej wrote:
> Yes, but only once to each client and I am only interested in listing categories for one client at once. So, for each client I would like a list of categories ordered as above, leaving unassigned categories to the end (although I can live without this if need be).
>
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/syCtsNsVk6EJ.
ClientCategory.define_indexes
ClientCategory.index_delta
Not sure I'll make the next Rails Camp UK (unless it's really soon), but am hoping to swing through London for the August LRUG, should all go to plan. Perhaps I'll catch you there :)
Cheers
--
Pat
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/HcP2jfXAqOAJ.