datastax_rails 1.0.17.7 → 1.0.18.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +0 -3
- data/config/solrconfig.xml +13 -155
- data/lib/datastax_rails/base.rb +6 -4
- data/lib/datastax_rails/cql/base.rb +1 -1
- data/lib/datastax_rails/persistence.rb +20 -14
- data/lib/datastax_rails/relation/search_methods.rb +24 -0
- data/lib/datastax_rails/relation/stats_methods.rb +69 -0
- data/lib/datastax_rails/relation.rb +29 -4
- data/lib/datastax_rails/tasks/column_family.rb +33 -0
- data/lib/datastax_rails/tasks/ds.rake +14 -2
- data/lib/datastax_rails/types/boolean_type.rb +1 -1
- data/lib/datastax_rails/types/float_type.rb +2 -2
- data/lib/datastax_rails/util/solr_repair.rb +14 -0
- data/lib/datastax_rails/version.rb +1 -1
- data/lib/datastax_rails.rb +5 -1
- data/lib/schema_migration.rb +4 -2
- data/spec/datastax_rails/types/float_type_spec.rb +35 -0
- data/spec/dummy/log/development.log +3 -0
- data/spec/dummy/log/test.log +525 -0
- data/spec/support/models.rb +5 -0
- metadata +8 -4
data/lib/datastax_rails.rb
CHANGED
@@ -28,6 +28,7 @@ module DatastaxRails
|
|
28
28
|
autoload :ModificationMethods
|
29
29
|
autoload :SearchMethods
|
30
30
|
autoload :SpawnMethods
|
31
|
+
autoload :StatsMethods
|
31
32
|
end
|
32
33
|
|
33
34
|
autoload :RSolrClientWrapper, 'datastax_rails/rsolr_client_wrapper'
|
@@ -36,6 +37,9 @@ module DatastaxRails
|
|
36
37
|
autoload :Serialization
|
37
38
|
autoload :Timestamps
|
38
39
|
autoload :Type
|
40
|
+
autoload_under 'util' do
|
41
|
+
autoload :SolrRepair
|
42
|
+
end
|
39
43
|
autoload :Validations
|
40
44
|
|
41
45
|
module AttributeMethods
|
@@ -92,4 +96,4 @@ end
|
|
92
96
|
require 'datastax_rails/railtie' if defined?(Rails)
|
93
97
|
require 'datastax_rails/errors'
|
94
98
|
|
95
|
-
ActiveSupport.run_load_hooks(:datastax_rails, DatastaxRails::Base)
|
99
|
+
ActiveSupport.run_load_hooks(:datastax_rails, DatastaxRails::Base)
|
data/lib/schema_migration.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Placeholder class to imitate a model for the schema migrations column family.
|
2
2
|
# Used as part of the CQL generation.
|
3
3
|
class SchemaMigration
|
4
|
-
|
5
|
-
|
4
|
+
def self.default_consistency
|
5
|
+
DatastaxRails::Base.default_consistency
|
6
|
+
end
|
7
|
+
|
6
8
|
# Returns the name of the column family
|
7
9
|
def self.column_family
|
8
10
|
'schema_migrations'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DatastaxRails::Types::FloatType do
|
4
|
+
before(:each) do
|
5
|
+
@coder = DatastaxRails::Types::FloatType.new
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#encode" do
|
9
|
+
it "should store decimals as Floats" do
|
10
|
+
@coder.encode(12.0).should be_a_kind_of(Float)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should convert properly formatted strings to Floats" do
|
14
|
+
@coder.encode("12.0").should be_a_kind_of(Float)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should raise an exception on improperly formatted strings" do
|
18
|
+
lambda { @coder.encode("foo") }.should raise_exception(ArgumentError)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should store a sentinel value for nils" do
|
22
|
+
@coder.encode(nil).should be_within(0.1).of(-10191980.0)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#decode" do
|
27
|
+
it "should return floats" do
|
28
|
+
@coder.decode(12.0).should be_within(0.1).of(12.0)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should return nil if the sentinel value is found" do
|
32
|
+
@coder.decode(-10191980.0).should be_nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -24149,3 +24149,6 @@ SELECT updated_at,birthdate,nickname,created_at,name FROM people USING CONSISTEN
|
|
24149
24149
|
cars insert (14.7ms) 3c8689c8-3711-11e2-9491-eeedd8a96be5 {"name"=>"Jeep Wrangler", "created_at"=>"2012-11-25T15:03:14Z", "updated_at"=>"2012-11-25T15:03:14Z"}
|
24150
24150
|
cars insert (24.8ms) a018528c-3711-11e2-9af9-581846c60a36 {"name"=>"Jeep Wrangler", "created_at"=>"2012-11-25T15:06:01Z", "updated_at"=>"2012-11-25T15:06:01Z"}
|
24151
24151
|
cars insert (3.0ms) 7be7798c-3712-11e2-9fcf-57cd20c86298 {"name"=>"Test: test", "created_at"=>"2012-11-25T15:12:10Z", "updated_at"=>"2012-11-25T15:12:10Z"}
|
24152
|
+
people insert (64.9ms) 5989f5a6-6b22-11e2-9533-d78b7614c5ee {"created_at"=>"2013-01-30T21:16:44Z", "nickname"=>"JimBob", "updated_at"=>"2013-01-30T21:16:44Z", "name"=>"JimBob"}
|
24153
|
+
jobs insert (49.8ms) ab429e24-752d-11e2-8d47-b0e75aa0ec84 {"created_at"=>"2013-02-12T16:02:58Z", "position_number"=>125, "updated_at"=>"2013-02-12T16:02:58Z", "title"=>"abc"}
|
24154
|
+
jobs insert (3.0ms) b040877e-752d-11e2-8879-539f2ad9c9e9 {"created_at"=>"2013-02-12T16:03:06Z", "position_number"=>175, "updated_at"=>"2013-02-12T16:03:06Z", "title"=>"def"}
|