Permalink
Browse files

Fix for field facets in indexes that have deltas (#71).

  • Loading branch information...
1 parent ecee83e commit 8b48e0f472f8f2c43abe81e48f260ffcc0de5eab @pat pat committed Dec 21, 2009
@@ -32,6 +32,7 @@ Feature: Update attributes directly to Sphinx
Then I should get 1 result
When I change the value of beta eight to 18
+ And I wait for Sphinx to catch up
And I filter by 18 on value
Then I should get 1 result
@@ -5,7 +5,7 @@ Feature: Search and browse across models by their defined facets
When I am requesting facet results
And I want all possible attributes
Then I should have valid facet results
- And I should have 11 facets
+ And I should have 12 facets
And I should have the facet Class
And the Class facet should have a "Person" key
And I should have the facet Gender
@@ -19,7 +19,7 @@ Feature: Search and browse across models by their defined facets
When I am requesting facet results
And I want all possible attributes
And I don't want classes included
- Then I should have 10 facets
+ Then I should have 11 facets
And I should not have the facet Class
Scenario: Requesting facets common to all indexed models
@@ -14,7 +14,7 @@ Feature: Keeping Sphinx in line with model changes when requested
And I search for two
Then I should get 1 result
- Scenario: Not returing an instance from old data if there is a delta
+ Scenario: Not returning an instance from old data if there is a delta
Given Sphinx is running
And I am searching on betas
When I search for two
@@ -1,6 +1,6 @@
class Beta < ActiveRecord::Base
define_index do
- indexes :name, :sortable => true
+ indexes :name, :sortable => true, :facet => true
has value
set_property :delta => true
@@ -352,6 +352,8 @@ def sphinx_value(value)
value.to_i
when Date
value.to_time.to_i
+ when String
+ value.to_crc32
else
value
end
@@ -558,5 +558,13 @@
@instance.stub!(:assoc_name => stub('object', :id => 42))
@attribute.live_value(@instance).should == 42
end
+
+ it "should translate crc strings to their integer values" do
+ @attribute = ThinkingSphinx::Attribute.new @source, [
+ stub('column', :__stack => [], :__name => "col_name")
+ ], :crc => true, :type => :string
+ @instance.stub!(:col_name => 'foo')
+ @attribute.live_value(@instance).should == 'foo'.to_crc32
+ end
end
-end
+end

0 comments on commit 8b48e0f

Please sign in to comment.