Have you run all your migrations in your demo environment? I think this query 
generation bug can happen when columns don't exist in the association tables...

-- 
Pat

On 28/06/2010, at 3:50 PM, Arun wrote:

> Hi Pat,
> 
> i made a mistake so do not consider whatever posted above.
> 
> Here is detailed version of this error:
> 
> Here is my define_index method looks like:
> 
> define_index do
>  indexes :preferred_name
>  indexes self.user.address.country.name, :as => :country_name
> end
> 
> See this doesn't trow any error when I rebuild TS in development env
> 
> The value for sql_query in development.sphinx.conf looks like:
> SELECT SQL_NO_CACHE `profiles`.`id` * 1 + 0 AS `id` ,
> CAST(`profiles`.`preferred_name` AS CHAR) AS `preferred_name`,
> CAST(`countries`.`name` AS CHAR) AS `country_name`, `profiles`.`id` AS
> `sphinx_internal_id`, 1323996051 AS `class_crc`, '1323996051' AS
> `subclass_crcs`, 0 AS `sphinx_deleted` FROM `profiles`    LEFT OUTER
> JOIN `users` ON `users`.id = `profiles`.user_id   LEFT OUTER JOIN
> `addresses` ON `addresses`.id = `users`.address_id   LEFT OUTER JOIN
> `countries` ON `countries`.id = `addresses`.country_id  WHERE
> `profiles`.`id` >= $start AND `profiles`.`id` <= $end GROUP BY
> `profiles`.`id`  ORDER BY NULL
> 
> See CAST(`countries`.`name` AS CHAR) AS `country_name`
> so it is not trowing any error in development env
> 
> But While rebuilding TS in demo env gives me following error
> ERROR: index 'profile_core': sql_range_query: Unknown column
> 'profiles.name'
> 
> Here is sql_query value in demo.sphinx.conf looks like:
> 
> SELECT SQL_NO_CACHE `profiles`.`id` * 1 + 0 AS `id` ,
> CAST(`profiles`.`preferred_name` AS CHAR) AS `preferred_name`,
> CAST(`profiles`.`name` AS CHAR) AS `country_name`, `profiles`.`id` AS
> `sphinx_internal_id`, 1323996051 AS `class_crc`, '1323996051' AS
> `subclass_crcs`, 0 AS `sphinx_deleted` FROM `profiles`    WHERE
> `profiles`.`id` >= $start AND `profiles`.`id` <= $end GROUP BY
> `profiles`.`id`  ORDER BY NULL
> 
> See CAST(`profiles`.`name` AS CHAR) AS `country_name`
> The same define_index is generating this in demo env.And this is what
> make TS throw sq
> l_query_range error
> 
> Any help would be greatly appreciated.
> 
> Thanks in advance.
> 
> On Jun 26, 11:12 am, Pat Allan <[email protected]> wrote:
>> Hi Arun
>> 
>> In your config/development.sphinx.conf file, you'll find the profile_core_0 
>> source - what's the sql_query value in that source?
>> 
>> --
>> Pat
>> 
>> On 26/06/2010, at 3:38 PM, Arun wrote:
>> 
>> 
>> 
>>> Hi,
>>> I want retrieve the company name in the profile model but due to
>>> relationship ,it is not get indexed.
>> 
>>> I am using the Profile model for indexes
>>>   1.In the profile model
>>>      belongs_to :user
>>> 2.  In the user model
>>>     belongs_to :address, :dependent => :destroy
>>>  3. In the address model
>>>    belongs_to :country
>>> so i given the indexes like this
>>> indexes user.address.country.name but it is throwing error like this
>>> "indexing index 'profile_core'...
>>> ERROR: index 'profile_core': sql_range_query: Unknown column
>>> 'profiles.name' in 'field list' (DSN=mysql://root:*...@localhost:"
>> 
>>> --
>>> 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 
>>> athttp://groups.google.com/group/thinking-sphinx?hl=en.
> 
> -- 
> 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.
> 

-- 
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