Just pushed a commit that provides the ability to scope index population:

  ThinkingSphinx::Index.define :article, :with => :real_time do
    indexes subject, content
    indexes user.name, :as => :user_name

    scope { Article.includes(:user) }
  end

To give it a spin, grab the latest from GitHub:

  gem 'thinking-sphinx', '~> 3.0.4',
    :git    => 'git://github.com/pat/thinking-sphinx.git',
    :branch => 'master',
    :ref    => '5d887ef89b'

Cheers

-- 
Pat

On 06/08/2013, at 5:48 AM, KIR wrote:

> Hello, 
> 
>    This weekend I tried migrating to TS 3.0 with RT indexes – and I’ve faced 
> the problem with initial data population.
> 
>    I have multiple attributes from the joined tables, and several methods 
> which retrieve those attributes. During initial indexing, this results in N+1 
> problem when collecting data.
>  
>    As far as I understand, there is no way to add “includes” and “joins” when 
> generating initial data, and this causes serious performance issues. 
> 
>    Could it be possible to add some syntax which would allow to specify 
> includes for data (re)generation? 
> 
>    Thanks,
>    KIR
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to