Ah, wait... the issue isn't that the column isn't there, it's that the JOINs 
aren't there... your Rails app code is the same on both dev and demo machines, 
yes?

-- 
Pat

On 28/06/2010, at 9:54 PM, Pat Allan wrote:

> Is your demo environment on the same machine? Or a different machine? If it's 
> a different machine, what version of Thinking Sphinx do you have installed on 
> the demo server?
> 
> And on the demo server, can you run 'script/dbconsole -p', and then the 
> following SQL statement:
> 
>  SELECT DISTINCT name FROM countries;
> 
> Does it work?
> 
> -- 
> Pat
> 
> On 28/06/2010, at 9:44 PM, Arun wrote:
> 
>> Hi Pat,
>> 
>> I have run all the migration in the demo environment
>> Development:
>> See CAST(`countries`.`name` AS CHAR) AS `country_name`
>> so it is not throwing any error in development env
>> Demo:
>> 
>> 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 .
>> 
>> Even though demo and Development have same configuration
>> demo:
>> #  enable_star: false
>> #  min_infix_len: 0
>> #  min_prefix_len: 0
>> sql_range_step: 10000000
>> mem_limit: 128M
>> max_matches: 10000
>> allow_star: false
>> bin_path: /usr/local/bin
>> searchd_binary_name: searchd
>> indexer_binary_name: indexer
>> 
>> development:
>> #  enable_star: false
>> #  min_infix_len: 0
>> #  min_prefix_len: 0
>> sql_range_step: 10000000
>> allow_star: false
>> max_matches: 10000
>> Any suggestions ,
>> 
>> 
>> On Jun 28, 4:21 pm, Pat Allan <[email protected]> wrote:
>>> 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 
>>>> 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.
> 

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