Forum: Ruby on Rails on Ultrasphinx Associations

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
539f79fceb6215bf063aed9a2f6dd5dd?d=identicon&s=25 SergioMB (Guest)
on 2009-02-25 23:04
(Received via mailing list)
I am new to ultrasphinx and I am struggling with this issue.

I ve got a model with the following associations and is_indexed
options:

class Item
has_many :keywords

is_indexed :fields => ['id', 'collection_id','subject_area',
'special_interest', 'notes', 'abstract'],
:concatenate => [{:association_name => 'keywords', :field =>
'keyword', :as => 'keyword_text'}]
end

When I try this in the console:
>> @b=Ultrasphinx::Search.new(:query => "Immoral behavior").run.results

I get 5 objects back, they do so because I know they match one of the
keywords in the :keywords assocations

[#<Item id: 329, collection_id: 117, notes: "", size_scope: "25
items", special_interest: "", subject_area: "WIH", abstract: "While
Evaline (Eva) Foster was in Malaysia from 189...">,
#<Item id: 308, collection_id: 137, notes: "This letter originated
from: Crittenden Family Pape...", size_scope: "16 pages",
special_interest: "", subject_area: "WIH", abstract: "While his wife,
Clara Jones Crittenden, stayed with...">, #<Item id: 1214,
collection_id: 110, notes: "", size_scope: "35 letters
(approximately)", special_interest: "", subject_area: "A-A", abstract:
"Of the Fenno-Hoffman Family papers, the letters wri...">,
#<Item id: 271, collection_id: 319, notes: "M-3462.2", size_scope: "1
page", special_interest: "", subject_area: "WIH", abstract: "Joseph F.
Huntoon wrote this letter to his wife, Be...">,
#<Item id: 1207, collection_id: 2, notes: "", size_scope: "3 pages",
special_interest: "", subject_area: "A-A", abstract: "Letter from
Oliver Swaine Taylor to an unidentified...">]

The problem is that in the fields retrieved in each object I don't see
the one I specified in the : concatenate options named 'keyword_text'
which is the one causing the matching.

Any help on how I can have access to those fields?

thanks!
s.
This topic is locked and can not be replied to.