We've looked at this some more and have a nice clean repro of the
issue: facets calculated using datetime delta are incorrect.
Here are our models:
class User < ActiveRecord::Base
define_index do
indexes name, :as => 'user_name'
has age, :as => 'user_age', :facet => true
set_property :delta => true, :threshold => 1.hour
end
end
class Company < ActiveRecord::Base
define_index do
indexes name, :as => 'company_name'
has partner_type, :as => 'partner_types', :facet => true
has revenue, :facet => true
set_property :delta => :datetime, :threshold => 1.hour
end
end
After populating into two models with a roughly even spread of
attributes and running a full ts:rebuild here is the output:
Company uses a datetime delta
> Company.facets
=> {:revenue=>{100=>10, 200=>8}, :partner_types=>{"OEM"=>6, "ISV"=>6,
"SP"=>6}}
I would expect this: {:revenue=>{100=>5,
200=>4}, :partner_types=>{"OEM"=>3, "ISV"=>3, "SP"=>3}}
> Company.all.map(&:revenue)
=> [100, 100, 100, 100, 100, 200, 200, 200, 200]
> Company.all.map(&:partner_type)
=> ["OEM", "OEM", "OEM", "ISV", "ISV", "ISV", "SP", "SP", "SP"]
User uses the default delta
> User.facets
=> {:user_age=>{30=>3, 20=>3}}
> User.all.map(&:age)
=> [20, 20, 20, 30, 30, 30]
We see even more weird behaviour when we start updating records and
running ts:index:delta (using the datetime) but this seems to be the
simplest problem.
To assist anyone interested in replicating this issue we've pushed a
sample app to github:
git://github.com/jhsu1/search_test.git
Thanks in advance.
Steven
On Mar 23, 11:16 am, Steven Holinaty <[email protected]> wrote:
> We're running thinkingsphinx 1.3.14 with 0.9.9-release sphinx in our
> dev environment (0.9.9-rc2 in our staging environment). We are trying
> to adopt faceting for our search. However, with a main and delta
> index, we are noticing that the faceting count is doubled. This does
> not occur when only the main index exists without any delta indexes.
> The generation of our delta index is done with the ts-datetime-delta
> gem version 1.0.2.
--
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.