In the large project I'm working on, we have many models that we want to index and search. I repeat things over and over ... and I know that it can be bad later when we make changes!
Is there a good way to save DRY code when using Thinking Sphinx? In particular, I have the following code block in each model that I want to index:
define_index do
...
set_property :delta => true
has :created_at
end
sphinx_scope(:only_active) do
{ :conditions => { :status => 1 } }
end
I expect this common code to grow in size and functionality as the project evolves ... not to mention that bugs can be fixed. Therefore, obviously, I would like to express this. I would like to be able to do something like:
define_index_with_common_settings do
...
end
... , .
? ?