As for delta indexes and sorting, yup, that's a limitation in Sphinx.
It calculates the ordinal values separately between indexes. There's
one way I've thought of fixing it, but Sphinx doesn't allow live
updates to the ordinal attributes, just normal ints, booleans and
timestamps.
> (in 3e5fc7370b93e543ffd6ca2e0f240bec47baf4b9)
> So I'm a bit unclear on how sphinx and TS handle delta indexes. I have
> a couple of issues:
> 1. My string type attributes don't seem to work for filtering with
> delta indexes but if I do something like has "contexts.state_status =
> 'published'", :as => :published, :type => :boolean it does.
> 2. true isn't converted into a MySQL boolean correctly.
> 3. Integer type attributes don't seem to work for sorting search
> results that come from a delta index. Including :order in the search
> params throws out all the delta results which would otherwise return
> without an :order key.
> Please see the code below for details.
> Thanks,
> Aaron
> class Context < ActiveRecord::Base
> define_index do
> indexes :name, :sortable => true
> indexes :desc
> has "contexts.state_status = 'published'", :as
> => :published, :type => :boolean
> has state_status, :type => :string
> has votes_count
> set_property :delta => true
> end
> end
> # I have a few contexts called pub 1, pub 2, pub 3, and pub 4... they
> are all state_status = 'published'
> Context.search(:conditions => {
> :state_status => 'published'
> })
> #=> []
> Context.search(:conditions => {
> :published => true
> })
> #=> error => cannot convert true to float
> Context.search(:conditions => {
> :published => 1
> })
> #=> [<Context ...>, <Context ...>, <Context ...>, <Context ...>]
> Context.search(:order => 'votes_count DESC')
> #=> []
> # exec: rake ts:stop && rake ts:index && rake ts:start
> Context.search(:order => 'votes_count DESC')
> #=> [<Context ...>, <Context ...>, <Context ...>, <Context ...>]