Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6602565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:53:30+00:00 2026-05-25T18:53:30+00:00

Sphinx & ThinkingSphinx are working great for me, however when a search returns back

  • 0

Sphinx & ThinkingSphinx are working great for me, however when a search returns back an array of results (models), I then notice in my logs that there are a large number of subsidiary SQL lookups to retrieve any associated models, these associations are defined within my model classes.

If I was just using ActiveRecord I could use the “include” feature to retrieve these associated records as part of the original search query, for example:

Booking.find_all_by_date(Date.today, :include => [:event,
:organizer, :sessions]
)

But I’m not sure how to implement this performance optimization in ThinkingSphinx, has anyone solved this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:53:30+00:00Added an answer on May 25, 2026 at 6:53 pm

    You do it exactly the same way – use :include, it’ll get passed through to the underlying ActiveRecord query when Thinking Sphinx translates Sphinx results to ActiveRecord objects.

    Edit: Since TS v3, the :include option is now contained within the :sql option:

    Booking.search(:sql => {:include => [:event, :organiser, :sessions]})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Sphinx to search MySQL. One of the results Sphinx returns for a
I am building search app using django & sphinx. I got the setup working
I am using Sphinx Search . It's working fine for me except one problem:
I have Thinking Sphinx setup and working however I am having a problem getting
I am trying out Sphinx search in my Django project. All setup done &
I'm using Thinking Sphinx for full-text search, following this video . I'd like to
I need sphinx to sort the results by the sum of an attribute. I
I'm trying to get sphinx search to return excerpts of matched documents. I'm using
Thinking sphinx documentation says that it automatically sorts the results based on relevance. What
I just installed Sphinx (distro: archlinux) downloading the source. Then I installed Thinking Sphinx

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.