Hi- I'm a big fan of both thinking sphinx and sphinx. I've been using sphinx for several years now and thinking sphinx is a real lifesaver for managing sphinx config files and is a wonderfully clean DSL.
Recently I've been using sphinx for a relatively small data set but lots of attributes that cache relationships among model objects. In order to make indexing more performant, I split several models' indices into sets. I read http://www.sphinxsearch.com/forum/view.html?id=3596 which points out that the indices need to be uniform. I was able to get multiple indices on the same model to work. This appears to be an undocumented feature, so thought I'd sketch out what I've done: - Within a model; say user.rb; create a couple (or more) index blocks: define_index :user_first do # fields indexes first_name, last_name, email, :sortable => true # attributes has 'null', :type => :multi, :as => :favorite_user_ids end define_index :user_second do # fields indexes first_name, last_name, email, :sortable => true # attributes has favorites.user(:id), :as => :favorite_user_ids end Note that :type => :multi is another type along with :string and :integer Note that I've included the fields and attributes in the same order and included them in both. It's important to tell sphinx that it is a multi attribute (if indeed that's what it is) as well. This is a simple example, but if you have a very complicated index on a model and find issues with the SQL that can be solved by splitting the SELECT statement into multiple statements, this is a good technique. You could also resort to hand-writing a SELECT statement but then obviously you lose out on the benefits that thinking sphinx provides of automatic query generation. Which is particularly valuable in the case of complex attributes. -- 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.
