Hi all I am having problems retrieving the associated fields that
caused some objets to be retrieved. I would really appreciate some
guidance. Until I don't resolve this issue I cant move ahead in my
project.
Hi have two models and look like this.
class Contact < ActiveRecord::Base
has_many :businesses
define_index do
indexes [first_name, last_name], :as => :name, :sortable => true
indexes street_address, city, country, postal_code
indexes [businesses.name, businesses.description], :as
=> :business_description
has state_id
end
end
class Business < ActiveRecord::Base
belongs_to :contact
end
When I search for a term I know is in the business name related to
that contact. I get the Contact object back associated with that
business. However, I need to have access to the field that caused the
matched in order to be able to excerpt it. This is what happens when I
run the search:
>> Contact.search "burlas"
=> [#<Contact id: 2, first_name: "Aaliyah", last_name: "Allen",
street_address: "71 Murphy Street", city: "Wyola West", country:
"Australia", postal_code: "6407", created_at: "2009-02-24 20:07:07",
updated_at: "2009-02-25 02:09:15", state_id: 2>]
How can I know that is bussinesses.name that caused the match???
Thanks
s.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---