Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 8b48e0f472f8f2c43abe81e48f260ffcc0de5eab 1 parent ecee83e
@pat pat authored
View
1  features/attribute_updates.feature
@@ -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
View
4 features/facets_across_model.feature
@@ -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
View
2  features/handling_edits.feature
@@ -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
View
2  features/support/models/beta.rb
@@ -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
View
2  lib/thinking_sphinx/attribute.rb
@@ -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
View
10 spec/thinking_sphinx/attribute_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.