Nope, Rails never does that, unfortunately (it really should!). You'll always 
need to do something like:

  add_index :comments, :post_id

-- 
Pat

On 17/07/2010, at 4:41 PM, Raphael wrote:

> i thinked that indexes are generated automatically by raisl =/
> Raphael William Costa 
> Telefone.   +55 41 8401273
> Email.         [email protected]
> Internet.      http://www.raphaelcosta.net
> 
> Em 17/07/2010, às 00:09, Pat Allan escreveu:
> 
>> It's definitely a good idea to index all foreign keys - whether you're using 
>> Sphinx or not.
>> 
>> -- 
>> Pat
>> 
>> On 15/07/2010, at 4:32 AM, Raphael wrote:
>> 
>>> Hi Pat,
>>> 
>>> Thanks! Now is taking only 20 seconds to index!!
>>> I need to create a index in all references?
>>> 
>>> Thanks,
>>> Raphael William Costa 
>>> Telefone.   +55 41 8401273
>>> Email.         [email protected]
>>> Internet.      http://www.raphaelcosta.net
>>> 
>>> Em 14/07/2010, às 04:05, Pat Allan escreveu:
>>> 
>>>> Hi Raphael
>>>> 
>>>> It definitely looks like you need the database index on that column - 
>>>> something like the following in a migration should do the trick:
>>>> 
>>>> add_index :entry_values, :entry_id
>>>> 
>>>> Give that a shot, let us know if it helps.
>>>> 
>>>> Cheers
>>>> 
>>>> -- 
>>>> Pat
>>>> 
>>>> On 14/07/2010, at 3:33 PM, Raphael wrote:
>>>> 
>>>>> Without that Field
>>>>> 
>>>>> ~/Ruby Projects/ngforms ree-1.8.7 (master) $ rake ts:rebuild
>>>>> (in /Users/raphael/Ruby Projects/ngforms)
>>>>> Stopped search daemon (pid 865).
>>>>> Generating Configuration to /Users/raphael/Ruby 
>>>>> Projects/ngforms/config/development.sphinx.conf
>>>>> Sphinx 0.9.9-release (r2117)
>>>>> Copyright (c) 2001-2009, Andrew Aksyonoff
>>>>> 
>>>>> using config file '/Users/raphael/Ruby 
>>>>> Projects/ngforms/config/development.sphinx.conf'...
>>>>> indexing index 'database_core'...
>>>>> collected 6 docs, 0.0 MB
>>>>> sorted 0.0 Mhits, 100.0% done
>>>>> total 6 docs, 45 bytes
>>>>> total 0.009 sec, 4741 bytes/sec, 632.17 docs/sec
>>>>> distributed index 'database' can not be directly indexed; skipping.
>>>>> indexing index 'entry_core'...
>>>>> collected 57842 docs, 0.3 MB
>>>>> sorted 0.1 Mhits, 100.0% done
>>>>> total 57842 docs, 272056 bytes
>>>>> total 0.729 sec, 373143 bytes/sec, 79334.18 docs/sec
>>>>> distributed index 'entry' can not be directly indexed; skipping.
>>>>> indexing index 'entry_value_core'...
>>>>> collected 254217 docs, 5.3 MB
>>>>> sorted 0.5 Mhits, 100.0% done
>>>>> total 254217 docs, 5282422 bytes
>>>>> total 3.683 sec, 1434192 bytes/sec, 69020.65 docs/sec
>>>>> distributed index 'entry_value' can not be directly indexed; skipping.
>>>>> total 9 reads, 0.016 sec, 936.7 kb/call avg, 1.8 msec/call avg
>>>>> total 32 writes, 0.079 sec, 590.6 kb/call avg, 2.4 msec/call avg
>>>>> Started successfully (pid 899).
>>>>> ~/Ruby Projects/ngforms ree-1.8.7 (master) $ 
>>>>> 
>>>>> 
>>>>> class Entry < ActiveRecord::Base
>>>>> 
>>>>> has_many :entry_values, :dependent => :destroy
>>>>> 
>>>>> define_index do
>>>>>   #indexes entry_values(:value_string), :as => :value_string
>>>>>   indexes entry_number
>>>>>   has has_error, created_at, updated_at
>>>>> end
>>>>> end
>>>>> 
>>>>> class EntryValue < ActiveRecord::Base
>>>>> belongs_to :entry
>>>>> 
>>>>> define_index do
>>>>>   indexes value_string
>>>>>   has entry_id
>>>>> end
>>>>> 
>>>>> end
>>>>> 
>>>>> -------
>>>>> 
>>>>> With this field take more than one hour to index...
>>>>> 
>>>>> 
>>>>> 
>>>>> Raphael William Costa 
>>>>> Telefone.   +55 41 8401273
>>>>> Email.         [email protected]
>>>>> Internet.      http://www.raphaelcosta.net
>>>>> 
>>>>> Em 14/07/2010, às 00:50, Pat Allan escreveu:
>>>>> 
>>>>>> Hi Raphael
>>>>>> 
>>>>>> How long did an index take without that field? And how long does it take 
>>>>>> when you add it? Do you have a database index on the entry_id column in 
>>>>>> the entry_values table?
>>>>>> 
>>>>>> Cheers
>>>>>> 
>>>>>> -- 
>>>>>> Pat
>>>>>> 
>>>>>> On 14/07/2010, at 12:52 PM, Raphael wrote:
>>>>>> 
>>>>>>> Hi,
>>>>>>> 
>>>>>>> I have a entry that has many entry_values...
>>>>>>> 
>>>>>>> And i need to get Entries that has a entry_values.value_string for
>>>>>>> example.
>>>>>>> 
>>>>>>> Entry.rb
>>>>>>> 
>>>>>>> define_index do
>>>>>>> indexes entry_values.value_string, :as => :entry_value_string
>>>>>>> end
>>>>>>> 
>>>>>>> But that solution take so long to index in compare to index
>>>>>>> entry_value fields...
>>>>>>> 
>>>>>>> Is correct to use like that? or How can i return a Entry in a
>>>>>>> EntryValue.search ?
>>>>>>> 
>>>>>>> Thanks in Advance,
>>>>>>> Raphael Costa
>>>>>>> 
>>>>>>> -- 
>>>>>>> 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.
>>>> 
>>>> -- 
>>>> 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.
>> 
> 
> 
> -- 
> 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