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 8359229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:04:51+00:00 2026-06-09T11:04:51+00:00

I use thinking-sphinx like this : class Project < ActiveRecord::Base define_index do indexes title

  • 0

I use thinking-sphinx like this :

class Project < ActiveRecord::Base
  define_index do
    indexes title
    indexes comments.message, as: :comment_message
    indexes category_projects.description, as: :category_description
  end

  class << self
    def text_search(word)
      ThinkingSphinx.search(word, include: :comments)
    end
  end
end

When I do this Project.text_search('test') it works but I want to do this :

@projects = Project.text_search('test')
@projects.each do |project|
  puts project.comment_message
end

For the moment I have this message :

undefined method `comment_message' for #<ThinkingSphinx::Search:0x000000057e11c0>
    from /home/dougui/.rvm/gems/ruby-1.9.3-p194-perf@comment_my_projects/bundler/gems/thinking-sphinx-b293abdbdf0c/lib/thinking_sphinx/search.rb:185:in `method_missing'
    from (irb):1
    from /home/dougui/.rvm/gems/ruby-1.9.3-p194-perf@comment_my_projects/gems/railties-3.2.6/lib/rails/commands/console.rb:47:in `start'
    from /home/dougui/.rvm/gems/ruby-1.9.3-p194-perf@comment_my_projects/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in `start'
    from /home/dougui/.rvm/gems/ruby-1.9.3-p194-perf@comment_my_projects/gems/railties-3.2.6/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

So, how to load fields into a model from thinking-sphinx?

I didn’t find anything one the doc.

Thanks!

  • 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-06-09T11:04:52+00:00Added an answer on June 9, 2026 at 11:04 am

    Answered on the TS mailing list as well, but essentially, the fields aren’t returned by Sphinx, so you just need to refer to the associations/columns that the fields are built from:

    projects.each do |project|
      puts project.comments.message.join("\n")
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use thinking sphinx in my project on refinery cms. And I received this
Unfortunatelly Thinking Sphinx can't simply convert time field to attribute class Place << ActiveRecord::Base
I have the following models. class Post < ActiveRecord::Base has_many :timeline_items, :as=>:subject define_index do
I have Ruby on Rails 3.1 application and i use for Sphinx + Thinking
Using PHP ... This is for my personal use so I'm thinking maybe 3-4
Started using thinking sphinx today and I'd like to know what's going wrong here:
I'm trying to use Sphinx (2.0.1 beta) with Thinking Sphinx 2.0.4 (on Rails 3.0.3).
Hey. I use Rails 3.0.1 with thinking-sphinx. How can I get a list of
The use case is this: I'd like to let my user search from a
I am going to use thinking sphinx for my application and it requires a

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.