#173 ✓resolved
Lukas Rieder

Eager loading associations when using a More Like This Query

Reported by Lukas Rieder | March 24th, 2011 @ 10:37 AM


recently we encountered an issue where data_accessor_for(...) is only implemented in Sunspot::DSL::Search. So this method, which we would like to use for eager loading associations, is not available in a Sunspot::DSL::MoreLikeThisQuery.

Could you make it available so that we can use code like the following?

    Sunspot.more_like_this(self, Document) do
      fields :title, :plain_text

      data_accessor_for(Document).include = [:authors, :editors]

At the moment I've just monkeypatched it into my application, but my knowledge of sunspot's internals is very weak. So if you point me the way, I'd be happy to submit a patch.

Cheers, Lukas

Comments and changes to this ticket

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 »

Awesome Solr interaction for Ruby

People watching this ticket