Permalink
Browse files

Merge branch 'v1'

  • Loading branch information...
pat committed Sep 5, 2012
2 parents 0d5b51e + 15774b8 commit 67e16840466a0db2e9483e505a0784b16586b1a6
@@ -268,14 +268,13 @@ def source_of_sphinx_index
end
def delete_in_index(index, document_id)
return unless ThinkingSphinx.sphinx_running? &&
search_for_id(document_id, index)
return unless ThinkingSphinx.sphinx_running?
ThinkingSphinx::Configuration.instance.client.update(
index, ['sphinx_deleted'], {document_id => [1]}
)
rescue Riddle::ConnectionError, Riddle::ResponseError,
ThinkingSphinx::SphinxError, Errno::ETIMEDOUT
ThinkingSphinx::SphinxError, Errno::ETIMEDOUT, Timeout::Error
# Not the end of the world if Sphinx isn't running.
end
@@ -112,12 +112,6 @@
@person.send(:index_delta)
end
it "shouldn't update the deleted attribute if not in the index" do
@client.should_not_receive(:update)
@person.send(:index_delta)
end
it "should update the deleted attribute if in the core index" do
Person.stub!(:search_for_id => true)
@client.should_receive(:update)
@@ -273,7 +273,6 @@
@configuration.stub!(:client => @client)
Person.sphinx_indexes.each { |index| index.stub!(:delta? => false) }
Person.stub!(:search_for_id => true)
end
it "should update the core index's deleted flag if in core index" do
@@ -284,19 +283,9 @@
@person.toggle_deleted
end
it "shouldn't update the core index's deleted flag if the record isn't in it" do
Person.stub!(:search_for_id => false)
@client.should_not_receive(:update).with(
"person_core", ["sphinx_deleted"], {@person.sphinx_document_id => [1]}
)
@person.toggle_deleted
end
it "shouldn't attempt to update the deleted flag if sphinx isn't running" do
ThinkingSphinx.stub!(:sphinx_running? => false)
@client.should_not_receive(:update)
Person.should_not_receive(:search_for_id)
@person.toggle_deleted
end
@@ -493,14 +482,6 @@
@client = stub('client')
ThinkingSphinx.stub!(:sphinx_running? => true)
ThinkingSphinx::Configuration.instance.stub!(:client => @client)
Alpha.stub!(:search_for_id => true)
end
it "should not update if the document isn't in the given index" do
Alpha.stub!(:search_for_id => false)
@client.should_not_receive(:update)
Alpha.delete_in_index('alpha_core', 42)
end
it "should direct the update to the supplied index" do

0 comments on commit 67e1684

Please sign in to comment.