I'm really not sure which performs better when searching, but from an indexing perspective, the first would certainly be faster.
Also, the first is simpler, and it's worth noting that specifying :sortable => true creates an attribute (firstname_sort, etc), and those attributes would need to exist in all three indices in your second example. So again, the first example is looking better. Cheers -- Pat On 10/12/2011, at 6:58 AM, Amirouche wrote: > Hi, > I have users table (firtname, lastname, alias, ...) with more than 1 > million records and my search is on firstname, lastname and alias. > which way is better to define sphinx index: > > 1- > class User < ActiveRecord::Base > define_index do > indexes :firstname, :sortable=>true > indexes :lastname, :sortable=>true > indexes :alias, :sortable=>true > > #attributes > ...... > end > > Or > 2- > class User < ActiveRecord::Base > define_index 'firsname' do > indexes :firstname, :sortable=>true > > #attributes > ...... > end > define_index 'lastname' do > indexes :lastname, :sortable=>true > > #attributes > ...... > end > define_index 'alias' do > indexes :alias, :sortable=>true > > #attributes > ...... > end > > thanks. > > -- > 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.
