datastax_rails 2.3.1 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 150f13ab506894d9c6edfc1ea23a858419cfc3da
4
- data.tar.gz: 2b13f273c0bd56d94f5439b3eb263bdcb5b616d1
3
+ metadata.gz: e80abdc73c3bac8e56fdb675295e529983946232
4
+ data.tar.gz: 5da1c5c5adb42a8fa0acbbd179dc8f418073cb56
5
5
  SHA512:
6
- metadata.gz: dc6b22915a67bd1a40f4adafde3a5238f12eb4f4a6f3e850c278df262170b9482460921e2134399897720a2c76a60d3eac6aed8272e83670962f8ab661671227
7
- data.tar.gz: 26dbfde1fd0233048bfc50d4271a3f17aef839ca82f2e8f4fa739cf61b98628795857b8626800949686c8f38605ff72e5d08fd4432177501fda2933bb7cb74dd
6
+ metadata.gz: 84d18abd6033f66ca2398dbdbb1e6d8971fa656b80b80b570144265a1135e2d8c106bd32c195beb518ce4346e47cd31a7fd677f531cb9d0fe6379644deee719f
7
+ data.tar.gz: 02d506b87d0868e49dd05b310c6c1777bef53c45e34a9520217cb65a2a909a2a355f2cb6b3f513158a3001e9f748a84736df66f72ef21ef938fd4b9897b4e8b2
@@ -13,6 +13,13 @@ Significant changes from SolandraObject:
13
13
  * Solr communication is now handled directly via RSolr
14
14
  * Bifurcation of data is no longer necessary as DSE writes data to SOLR automatically
15
15
 
16
+ As of 2.4.0, DSE 4.7 is supported and live indexing is enabled by default.
17
+ If you are using any version prior to DSE 4.7 or do not wish to use live indexing,
18
+ you will want to override the following settings:
19
+
20
+ DatastaxRails::Base.solr_commit_time = 5000
21
+ DatastaxRails::Base.ram_buffer_size = 100
22
+
16
23
  === Usage Note
17
24
 
18
25
  Before using this gem, you should probably take a strong look at the type of problem you are trying to solve.
@@ -47,7 +47,7 @@
47
47
  that you fully re-index after changing this setting as it can
48
48
  affect both how text is indexed and queried.
49
49
  -->
50
- <luceneMatchVersion>LUCENE_46</luceneMatchVersion>
50
+ <luceneMatchVersion>4.10.3</luceneMatchVersion>
51
51
 
52
52
  <!-- Enable DSE Search new type mappings -->
53
53
  <dseTypeMappingVersion>2</dseTypeMappingVersion>
@@ -111,7 +111,7 @@
111
111
  <indexConfig>
112
112
 
113
113
  <useCompoundFile>false</useCompoundFile>
114
- <ramBufferSizeMB>100</ramBufferSizeMB>
114
+ <ramBufferSizeMB><%= @ram_buffer_size %></ramBufferSizeMB>
115
115
  <mergeFactor>10</mergeFactor>
116
116
 
117
117
  <!-- Unlock On Startup
@@ -392,9 +392,17 @@ module DatastaxRails #:nodoc:
392
392
  # See {DatastaxRails::WideStorageModel} or {DatastaxRails::Payload} model for an example
393
393
  class_attribute :create_options
394
394
 
395
- # Allows the setting of how frequently to commit data to solr. Default is 10s.
395
+ # Allows the setting of how frequently to commit data to solr. Default is 1000ms.
396
+ # If you're running something prior to DSE 4.7 or not using live indexing, you should
397
+ # change this to at least 5000ms.
396
398
  class_attribute :solr_commit_time
397
- self.solr_commit_time = 10_000
399
+ self.solr_commit_time = 1000
400
+
401
+ # Allows the setting of how much memory to dedicate to the solr ram buffer. This defaults to 2000MB
402
+ # in order to allow live indexing to do its thing. If you don't want to use live indexing (or if you
403
+ # are using DSE prior to 4.7) you should set this to something more reasonable like 100MB.
404
+ class_attribute :ram_buffer_size
405
+ self.ram_buffer_size = 2000
398
406
 
399
407
  # Stores the attribute that wide models should cluster on. Basically, this is the
400
408
  # attribute that CQL uses to "group" columns into logical records even though they
@@ -16,6 +16,31 @@ module DatastaxRails
16
16
  @errors = []
17
17
  end
18
18
 
19
+ def reindex_all
20
+ say_with_time('Reindexing all models') do
21
+ FileList[rails_models].each do |model|
22
+ require model
23
+ end
24
+
25
+ count = 0
26
+ DatastaxRails::Base.models.each do |m|
27
+ count += reindex_one(m) unless m.abstract_class?
28
+ end
29
+ count
30
+ end
31
+ end
32
+
33
+ def reindex_one(model)
34
+ count = 0
35
+ unless model <= DatastaxRails::CassandraOnlyModel
36
+ say_with_time("Reindexing #{model.name}") do
37
+ reindex_solr(model, false)
38
+ count += 1
39
+ end
40
+ end
41
+ count
42
+ end
43
+
19
44
  def migrate_all(force = false)
20
45
  say_with_time('Migrating all models') do
21
46
  FileList[rails_models].each do |model|
@@ -67,6 +67,7 @@ module DatastaxRails
67
67
  solrconfig = Rails.root.join('config', 'solr', "#{model.column_family}-solrconfig.xml").read
68
68
  else
69
69
  @solr_commit_time = model.solr_commit_time
70
+ @ram_buffer_size = model.ram_buffer_size
70
71
  solrconfig = ERB.new(File.read(File.join(File.dirname(__FILE__), '..', '..', '..', 'config', 'solrconfig.xml.erb'))).result(binding)
71
72
  end
72
73
  if Rails.root.join('config', 'solr', "#{model.column_family}-stopwords.txt").exist?
@@ -37,8 +37,10 @@ namespace :ds do
37
37
  task :reindex, [:model] => :configure do |_t, args|
38
38
  if args[:model].blank?
39
39
  puts "\nUSAGE: rake ds:reindex[Model]"
40
+ elsif args[:model] == 'all'
41
+ @migrator.reindex_all
40
42
  else
41
- @migrator.reindex_solr(args[:model].constantize)
43
+ @migrator.reindex_one(args[:model].constantize)
42
44
  end
43
45
  end
44
46
 
@@ -1,4 +1,4 @@
1
1
  # rubocop:disable Style/Documentation
2
2
  module DatastaxRails
3
- VERSION = '2.3.1'
3
+ VERSION = '2.4.0'
4
4
  end
@@ -33,8 +33,8 @@ describe DatastaxRails::DynamicModel do
33
33
  two.save
34
34
  one.destroy
35
35
  DynamicTestModel1.commit_solr
36
- expect(DynamicTestModel1.count).to be(0)
37
36
  DynamicTestModel2.commit_solr
37
+ expect(DynamicTestModel1.count).to be(0)
38
38
  expect(DynamicTestModel2.count).to be(1)
39
39
  end
40
40
 
@@ -571,3 +571,21 @@
571
571
  TeamMetadata CQL (7.9ms) INSERT INTO dynamic_model (group,id,s_,d_) VALUES (?,?,?,?)  ["team", #<Cassandra::TimeUuid:0x007f4544991598 @n=194877043329956181002329162597684281855>, {"s_source"=>"TV", "s_medium"=>"television"}, {"d_published_on"=>2015-04-28 00:00:00 UTC}] - 0 results
572
572
  CoreMetadata Search (6.4ms) {q: "(bbc)", sort: "", fq: ["group:(core)"], fl: "id,group,s_*,t_*,b_*,d_*,l_*,db_*,ts_*,i_*,f_*,u_*", page: 1, per_page: 100000}
573
573
  CoreMetadata Search (5.2ms) {q: "(tv)", sort: "", fq: ["group:(core)"], fl: "id,group,s_*,t_*,b_*,d_*,l_*,db_*,ts_*,i_*,f_*,u_*", page: 1, per_page: 100000}
574
+ PersonRole Search (11.4ms) {q: "*:*", sort: "", fq: ["person_id:(73fd1d42-2190-11e5-a954-4136c888eb9c)"], fl: "id,person_id,role_id,created_at,updated_at", page: 1, per_page: 100000}
575
+ Role CQL (7.7ms) SELECT id,name,created_at,updated_at FROM roles WHERE "id" IN (?,?) LIMIT 100000 [#<Cassandra::TimeUuid:0x007f0b38e2c800 @n=154185041942365393188856393493624783394>, #<Cassandra::TimeUuid:0x007f0b38e2e100 @n=154208614697558262256981922784432414106>] - 2 results
576
+ Person Search (5.2ms) {q: "*:*", sort: "", fq: ["sort_name:(steve)"], fl: "id", page: 1, per_page: 1}
577
+ Person CQL (7.8ms) INSERT INTO people (name,str_,created_at,updated_at,id) VALUES (?,?,?,?,?) ["Steve", {"str_favorite_color"=>"blue"}, 2015-07-03 14:33:27 UTC, 2015-07-03 14:33:27 UTC, #<Cassandra::TimeUuid:0x007f0b38e63c38 @n=159442905651352150554347113102875752322>] - 0 results
578
+ Person Search (6.5ms) {q: "*:*", sort: "", fq: ["str_favorite_color:(blue)"], fl: "id,name,birthdate,nickname,email_addresses,str_*,created_at,updated_at", page: 1, per_page: 100000}
579
+ CoreMetadata CQL (5.6ms) INSERT INTO dynamic_model (group,s_,ts_,id) VALUES (?,?,?,?) ["core", {"s_source"=>"BBC", "s_author"=>"John"}, {"ts_published_at"=>2015-07-03 14:33:30 UTC}, #<Cassandra::TimeUuid:0x007f0b38ec2990 @n=161544733729060566312981916619281616201>] - 0 results
580
+ TeamMetadata CQL (4.8ms) INSERT INTO dynamic_model (group,id,s_,d_) VALUES (?,?,?,?)  ["team", #<Cassandra::TimeUuid:0x007f0b38ef8360 @n=161544733729060566312981916619281616201>, {"s_source"=>"TV", "s_medium"=>"television"}, {"d_published_on"=>2015-07-03 00:00:00 UTC}] - 0 results
581
+ CoreMetadata Search (22.4ms) {q: "(bbc)", sort: "", fq: ["group:(core)"], fl: "id,group,s_*,t_*,b_*,d_*,l_*,db_*,ts_*,i_*,f_*,u_*", page: 1, per_page: 100000}
582
+ CoreMetadata Search (39.2ms) {q: "(tv)", sort: "", fq: ["group:(core)"], fl: "id,group,s_*,t_*,b_*,d_*,l_*,db_*,ts_*,i_*,f_*,u_*", page: 1, per_page: 100000}
583
+ PersonRole Search (5.5ms) {q: "*:*", sort: "", fq: ["person_id:(212ef5e4-2196-11e5-88d7-1d26c3e00733)"], fl: "id,person_id,role_id,created_at,updated_at", page: 1, per_page: 100000}
584
+ Role CQL (4.1ms) SELECT id,name,created_at,updated_at FROM roles WHERE "id" IN (?,?) LIMIT 100000 [#<Cassandra::TimeUuid:0x007f8900dd1e28 @n=44121189366645637896307254878190144332>, #<Cassandra::TimeUuid:0x007f8900dd1bd0 @n=44139174951818001042741152732173921356>] - 2 results
585
+ Person Search (3.8ms) {q: "*:*", sort: "", fq: ["sort_name:(steve)"], fl: "id", page: 1, per_page: 1}
586
+ Person CQL (5.3ms) INSERT INTO people (name,str_,created_at,updated_at,id) VALUES (?,?,?,?,?) ["Steve", {"str_favorite_color"=>"blue"}, 2015-07-03 15:14:07 UTC, 2015-07-03 15:14:07 UTC, #<Cassandra::TimeUuid:0x007f8900e04d50 @n=50807323722007417899209455217420016375>] - 0 results
587
+ Person Search (5.7ms) {q: "*:*", sort: "", fq: ["str_favorite_color:(blue)"], fl: "id,name,birthdate,nickname,email_addresses,str_*,created_at,updated_at", page: 1, per_page: 100000}
588
+ CoreMetadata CQL (4.9ms) INSERT INTO dynamic_model (group,s_,ts_,id) VALUES (?,?,?,?) ["core", {"s_source"=>"BBC", "s_author"=>"John"}, {"ts_published_at"=>2015-07-03 15:14:10 UTC}, #<Cassandra::TimeUuid:0x007f8900e69ea8 @n=52989871036248616450023570844302361768>] - 0 results
589
+ TeamMetadata CQL (7.7ms) INSERT INTO dynamic_model (group,id,s_,d_) VALUES (?,?,?,?)  ["team", #<Cassandra::TimeUuid:0x007f8900eb2ef0 @n=52989871036248616450023570844302361768>, {"s_source"=>"TV", "s_medium"=>"television"}, {"d_published_on"=>2015-07-03 00:00:00 UTC}] - 0 results
590
+ CoreMetadata Search (4.4ms) {q: "(bbc)", sort: "", fq: ["group:(core)"], fl: "id,group,s_*,t_*,b_*,d_*,l_*,db_*,ts_*,i_*,f_*,u_*", page: 1, per_page: 100000}
591
+ CoreMetadata Search (32.3ms) {q: "(tv)", sort: "", fq: ["group:(core)"], fl: "id,group,s_*,t_*,b_*,d_*,l_*,db_*,ts_*,i_*,f_*,u_*", page: 1, per_page: 100000}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datastax_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason M. Kusar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-19 00:00:00.000000000 Z
11
+ date: 2015-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '2.1'
40
40
  - - '>='
41
41
  - !ruby/object:Gem::Version
42
- version: 2.1.1
42
+ version: 2.1.4
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '2.1'
50
50
  - - '>='
51
51
  - !ruby/object:Gem::Version
52
- version: 2.1.1
52
+ version: 2.1.4
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rsolr
55
55
  requirement: !ruby/object:Gem::Requirement