Hi to all.
I have kind of a problem when trying to test thinking sphinx in my
Rails application. I don't want to mock it because I want to be sure
config and search options are working the desired way.
- Ruby: 1.8.7 (i686-darwin10.6.0); Rails: 2.3.11; Thinking Sphinx: 1.4.3
I only index a join-table model:
class AffiliatesAddress < ActiveRecord::Base
# DB relations:
belongs_to :address
belongs_to :affiliate, :polymorphic => true, :dependent => :delete
# Thinking-sphinx configuration
define_index do
...
has affiliate.direct, :as => :formato_direct, :type => :boolean
has affiliate.papel, :as => :formato_papel, :type => :boolean
has 'CRC32(affiliate_type)', :as => :affiliate_type, :type => :integer
end
end
To setup sphinx I need a relation for every affiliate type in DB,
which is ok. The problem is that if I save those relations in the same
execution I configure thinking sphinx, indexing is not aware of the
data in DB.
For example: I created a rake task as a per-requisite for
thinking-sphinx:index. The first time i run index, with an empty DB,
the config process doesn´t create the right SQL (it does without
polymorphic relations). But if I run index one more time, this time
with the relations remaining from previous execution, then all goes
ok. The same if I save the relations in a before(:all) block from
rspec. I am pretty sure relations are successfully saved before
calling indexing/config process.
In local, I generated the config first and then tweaked the tests to
avoid config again when DB is empty. But it's not a good solution for
the integration server or to share with the other team members.
Am I doing something wrong (other than my English)? some ideas?
Thanks for your time.
--
Rodrigo García Suárez
--
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.