Permalink
Browse files

Allowing for NULLs in MVAs - forcing conversion to 0

  • Loading branch information...
1 parent 4552bf8 commit 2079b0d7e01009a2d2a51e4d93819d117b3fc522 @pat pat committed Sep 27, 2009
@@ -60,6 +60,18 @@ Feature: Searching on a single model
And I filter by both 11 and 12 on dimensions
Then I should get 1 result
+ Scenario: Searching by NULL/0 values in MVAs
+ Given Sphinx is running
+ And I am searching on boxes
+ When I filter by 0 on dimensions
+ Then I should get 1 result
+
+ Given Sphinx is running
+ And I am searching on developers
+ When I clear existing filters
+ And I filter by 0 on tag_ids
+ Then I should get 1 result
+
Scenario: Searching on a MVA configured as ranged_query
Given Sphinx is running
And I am searching on posts
@@ -5,3 +5,5 @@
(11..20).each do |i|
Box.create :width => i, :length => i+1, :depth => i+2
end
+
+Box.create :width => 5, :length => 5, :depth => nil
@@ -23,3 +23,5 @@
)
end
end
+
+Tagging.create(:taggable => Developer.last)
@@ -1,5 +1,5 @@
ActiveRecord::Base.connection.create_table :boxes, :force => true do |t|
t.column :width, :integer, :null => false
t.column :length, :integer, :null => false
- t.column :depth, :integer, :null => false
+ t.column :depth, :integer
end
@@ -1,5 +1,5 @@
ActiveRecord::Base.connection.create_table :taggings, :force => true do |t|
- t.column :tag_id, :integer, :null => false
+ t.column :tag_id, :integer
t.column :taggable_id, :integer, :null => false
t.column :taggable_type, :string, :null => false
end
@@ -100,6 +100,8 @@ def to_select_sql
adapter.convert_nulls(part)
when :datetime
adapter.cast_to_datetime(part)
+ when :multi
+ adapter.convert_nulls(part, 0)
else
part
end

0 comments on commit 2079b0d

Please sign in to comment.