Created
August 24, 2009 02:26
-
-
Save yob/173609 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # a Delta indexing handler for Thinking Sphinx. By default TS rebuilds | |
| # the delta index within the users request cycle. This is *bad* for | |
| # speed reasons. | |
| # | |
| # Using this handler causes the delta indexes to be rebuilt via the | |
| # async queue. | |
| # | |
| class RudeqDelta < ThinkingSphinx::Deltas::DefaultDelta | |
| def index(model, instance = nil) | |
| return true unless ThinkingSphinx.updates_enabled? && ThinkingSphinx.deltas_enabled? | |
| return true if instance && !toggled(instance) | |
| # first rebuild the delta index | |
| RudeQueue.general_unless_dupe(:sphinx_delta, :index => delta_index_name(model)) | |
| # then remove the changed instance from the core index if necessary | |
| if instance | |
| RudeQueue.general_unless_dupe(:sphinx_flag_deleted, :index => core_index_name(model), | |
| :doc_id => instance.sphinx_document_id) | |
| end | |
| true | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment