#87 ✓resolved
Michael Raidel

Overriding default Join-type necessary?

Reported by Michael Raidel | May 11th, 2009 @ 11:05 AM

Hello Ben,

is it really necessary to override the default InnerJoinAssociation-Join-Type? This can break associations everywhere in a Rails-application, also if they are not used by any Searchlogic-search. I think it is better if the developer has to choose another JOIN-type manually if necessary than to override and maybe break associations per default.

Thank you for a great plugin,

Michael

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson May 11th, 2009 @ 02:17 PM

    • State changed from “new” to “open”

    Yes, here is my comment in the code

    # Inner joins impose limitations on queries. They can be quicker but you can't do OR conditions when conditions # overlap from the base model to any of its associations. Also, inner joins won't allow you to order by an association # attribute. What if the association is optional? All of those records are ommitted. It just doesn't make sense to default # to inner joins when providing this as a "convenience" when searching. So let's change it.
  • Michael Raidel

    Michael Raidel May 11th, 2009 @ 02:43 PM

    thanks for your answer Ben. I have seen the comment, but for me, the most serious side-effect of the change is not speed (like you already mention in the comment) but that the query can deliver other results (which can break existing applications, also in areas which don't use Searchlogic).

  • Ben Johnson

    Ben Johnson May 11th, 2009 @ 02:55 PM

    • State changed from “open” to “resolved”

    Michael, I completely agree, the problem is that searchlogic just leverages AR, the only way to get around this is to introduce a new option to AR that searchlogic can use. I'd LOVE to use the :include option, but that is a serious performance issue. I wish AR had :inner_joins and :outer_joins options. Anyways, the easiest and best thing I could do is the current implementation. I plan on changing this for searchlogic 2.0 when I can find time. I'm going to take searchlogic out of AR all together.

    Unless you want to take a stab at it, I can't really change this right now. Sorry.

  • seomaster
  • seomaster

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket

Pages