Permalink
Browse files

Issue #260: Don't add filter if without_ids is empty

  • Loading branch information...
Jason Rust
Jason Rust committed Jul 29, 2011
1 parent 4ca4e28 commit 1566b1241ecd9ee338829bd1ff3812246033a7b4
Showing with 8 additions and 1 deletion.
  1. +1 −1 lib/thinking_sphinx/search.rb
  2. +7 −0 spec/thinking_sphinx/search_spec.rb
@@ -718,7 +718,7 @@ def internal_filters
filters << Riddle::Client::Filter.new(
'sphinx_internal_id', filter_value(options[:without_ids]), true
- ) if options[:without_ids]
+ ) if options[:without_ids].present?
filters
end
@@ -636,6 +636,13 @@
filter.attribute.should == 'sphinx_internal_id'
filter.exclude?.should be_true
end
+
+ it "should not filter out any ids if :without_ids is an empty array" do
+ ThinkingSphinx::Search.new(:without_ids => []).first
+
+ filter = @client.filters.last
+ filter.attribute.should_not == 'sphinx_internal_id'
+ end
end
describe 'sort mode' do

0 comments on commit 1566b12

Please sign in to comment.