Hello,

I have three models that I've set up to be indexed using TS. I wish
for the results to be returned in one search and I then take care of
displaying the different model objects in different ways in my view.

I have set things up so that the TS define_index method in each model
can be essentially the same (the attribute aliases are named the same
thing across all three models):

  # Thinking Sphinx options
  define_index do
    indexes :name, :sortable => true
    has suburb.state_id, :as => :suburb_state_id
    has suburb.name, :as => :suburb_name
    has suburb.postcode, :as => :suburb_postcode
    has enabled
  end

In my Searches controller I have:

    unless params[:search][:q].blank?
      @results = ThinkingSphinx.search(params[:search][:q],
                                       :with => { :enabled => true,
                                                  :suburb_state_id =>
params[:search][:state_id],
                                                  :suburb_name =>
params[:search][:suburb_name],
                                                  :suburb_postcode =>
params[:search][:suburb_postcode] })
    else
      @results = nil
    end

Everything works fine when only params[:search][:q] contains a string,
I get the expected results back. But as soon as params[:search]
[:state_id] or params[:search][:suburb_name] or params[:search]
[:suburb_postcode] actually contain anything, I get an error like:

undefined method `>>' for "7":String

"7" being the value that params[:search][:state_id] contains. can
anyone tell me what I'm doing wrong here?

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to