Have you run `rake ts:rebuild` since adding that field to your index 
definition? Can you provide an example of the search you're running, and the 
result you're expecting to see?

On 3 Apr 2014, at 3:34 am, Fernanda Aispuro <[email protected]> wrote:

> Yes there is.
> But my result set is always empty. The same happens with other associations 
> like user.couple_detail.fname.
> 
> Any suggestions as to how what to try?
> Thanks Pat
> 
> 
> On Tue, Apr 1, 2014 at 4:29 PM, Pat Allan <[email protected]> wrote:
> Hi Fernanda
> 
> It looks like you have the association names correct for the field - is there 
> a database column called business_name in the vendor_details table?
> 
> -- 
> Pat
> 
> On 2 Apr 2014, at 9:22 am, Fernanda Aispuro <[email protected]> 
> wrote:
> 
>> First time using TS.
>> I've seen questions about drilling down on associations for indexing, but 
>> not what I need.
>> 
>> This are my models:
>> 
>> Rating.rb
>> belongs_to :associated, polymorphic=> true
>> belongs_to :user
>> #associated is a user that has_one :vendor_detail
>> #user will be user that has_one :couple_detail
>> 
>> User.rb
>> has_one :vendor_detail
>> has_one :couple_detail
>> has_many :ratings, as: :associated
>> 
>> ThinkingSphinx::Index.define :rating, :with => :active_record do
>>  indexes associated_id
>>  indexes user.email, :as => :email
>>  indexes user.vendor_detail.business_name, :as => :business_name
>>  has user_id, updated_at
>> end
>> 
>> associated_id and user.email return the expected results.
>> However, ser.vendor_detail.business_name returns empty. I tried adding the 
>> line  'join user.vendor_detail', but nothing changes.
>> 
>> My development.sphinx.config says:
>> source rating_core_0
>> {
>>   type = mysql
>>   sql_host = localhost
>>   sql_user = root
>>   sql_pass = 
>>   sql_db = weddingful_dev
>>   sql_query_pre = SET TIME_ZONE = '+0:00'
>>   sql_query_pre = SET NAMES utf8
>>   sql_query = SELECT SQL_NO_CACHE `ratings`.`id` * 12 + 3 AS `id`, 'Rating' 
>> AS `sphinx_internal_class_name`, `ratings`.`associated_id` AS 
>> `associated_id`, users.`email` AS `email`, `ratings`.`id` AS 
>> `sphinx_internal_id`, 'Rating' AS `sphinx_internal_class`, 0 AS 
>> `sphinx_deleted`, couple_detail.`fname` AS `first_name`, `ratings`.`user_id` 
>> AS `user_id`, UNIX_TIMESTAMP(`ratings`.`updated_at`) AS `updated_at` FROM 
>> `ratings` LEFT OUTER JOIN `users` ON `users`.`id` = `ratings`.`user_id` LEFT 
>> OUTER JOIN `couple_detail` ON `couple_detail`.`user_id` = `users`.`id` WHERE 
>> (`ratings`.`id` BETWEEN $start AND $end) GROUP BY `ratings`.`id`, 
>> `ratings`.`associated_id`, users.`email`, `ratings`.`id`, 
>> couple_detail.`fname`, `ratings`.`user_id`, `ratings`.`updated_at` ORDER BY 
>> NULL
>>   sql_query_range = SELECT IFNULL(MIN(`ratings`.`id`), 1), 
>> IFNULL(MAX(`ratings`.`id`), 1) FROM `ratings` 
>>   sql_attr_uint = sphinx_internal_id
>>   sql_attr_uint = sphinx_deleted
>>   sql_attr_uint = user_id
>>   sql_attr_timestamp = updated_at
>>   sql_attr_string = sphinx_internal_class
>>   sql_attr_string = first_name
>>   sql_query_info = SELECT `ratings`.* FROM `ratings`  WHERE (`ratings`.`id` 
>> = ($id - 3) / 12)
>> }
>> 
>> Any ideas what I'm doing wrong?
>> Thanks!
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Thinking Sphinx" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/thinking-sphinx.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to