Hello-
  So I am using sphinx to access a model that has belongs to two other
models, let's call them 'A' and 'B'.  So the definition is something
like:
belongs_to :A
belongs_to: B

  I have it working where I create indexes based on the columns of A
and B and that is working great.  The resulting query though, after
finding the results does something like:
SELECT * FROM `C` WHERE (`C`.`id` IN (65018927,65019058,.....)

So I get back a number of C's.  What I have to do then in my view is
iterate through my C's displaying columns of A and B like:

<% C.B.name C.A.description .... %>

Which results in a number of queries.

What I would like to do is make the MySql query join once the result
set is returned so that i can do something like:
<% C.b_name C.a_description ..... %>

which would result in a single join as opposed to N queries.  They are
normally cached, but still when i have lots of users etc it could be
slow.

This is probably dead simple, but I'm not sure how to do it.  Is there
something I put in my C.search .... call that will modify the
resulting mysql query to do this automatically?

Thanks.
Erik

--~--~---------~--~----~------------~-------~--~----~
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