datastax_rails 2.4.0 → 2.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +2 -3
- data/config/solrconfig.xml.erb +2 -1
- data/lib/datastax_rails/base.rb +14 -7
- data/lib/datastax_rails/relation.rb +1 -1
- data/lib/datastax_rails/schema/solr.rb +10 -8
- data/lib/datastax_rails/version.rb +1 -1
- data/spec/dummy/log/test.log +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c995883ead403d6ca3e7fb247feaec562361cd40
|
4
|
+
data.tar.gz: d81eaeeee8b20156ff6e752c8ce7da6037ffad4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c87e71d2898ac4d3e73d9676083ef48d48ee936dfaf3ffb343e551b3298568884a5444e09530b2e411704daa23dce1c949b830a15e147da0ec33535e1a9628d3
|
7
|
+
data.tar.gz: ad90941b3f68b77c2ce2ae0746b1effdf2f2f7e0590288ab5fc9ac99026214dc56695e4275db6a82103ab3c8d17b1bb20e732c8e548bef8dcf8f0cf293d1b22c
|
data/README.rdoc
CHANGED
@@ -15,10 +15,9 @@ Significant changes from SolandraObject:
|
|
15
15
|
|
16
16
|
As of 2.4.0, DSE 4.7 is supported and live indexing is enabled by default.
|
17
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
|
18
|
+
you will want to override the following setting:
|
19
19
|
|
20
|
-
DatastaxRails::Base.
|
21
|
-
DatastaxRails::Base.ram_buffer_size = 100
|
20
|
+
DatastaxRails::Base.live_indexing = false
|
22
21
|
|
23
22
|
=== Usage Note
|
24
23
|
|
data/config/solrconfig.xml.erb
CHANGED
@@ -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
|
50
|
+
<luceneMatchVersion><%= @lucene_match_version %></luceneMatchVersion>
|
51
51
|
|
52
52
|
<!-- Enable DSE Search new type mappings -->
|
53
53
|
<dseTypeMappingVersion>2</dseTypeMappingVersion>
|
@@ -111,6 +111,7 @@
|
|
111
111
|
<indexConfig>
|
112
112
|
|
113
113
|
<useCompoundFile>false</useCompoundFile>
|
114
|
+
<rt><%= @live_indexing %></rt>
|
114
115
|
<ramBufferSizeMB><%= @ram_buffer_size %></ramBufferSizeMB>
|
115
116
|
<mergeFactor>10</mergeFactor>
|
116
117
|
|
data/lib/datastax_rails/base.rb
CHANGED
@@ -392,17 +392,24 @@ module DatastaxRails #:nodoc:
|
|
392
392
|
# See {DatastaxRails::WideStorageModel} or {DatastaxRails::Payload} model for an example
|
393
393
|
class_attribute :create_options
|
394
394
|
|
395
|
-
#
|
396
|
-
#
|
397
|
-
|
395
|
+
# Whether or not to enable DSE 4.7 live indexing. Default is true. If using DSE < 4.7
|
396
|
+
# or if you don't want to use live indexing, set to false.
|
397
|
+
class_attribute :live_indexing
|
398
|
+
self.live_indexing = true
|
399
|
+
|
400
|
+
# Allows the setting of how frequently to commit data to solr. Default is 1000ms if
|
401
|
+
# live indexing is enabled. 5000ms otherwise.
|
402
|
+
# Setting this to lower than these values runs the risk of corrupting your indexes.
|
398
403
|
class_attribute :solr_commit_time
|
399
|
-
self.solr_commit_time = 1000
|
400
404
|
|
401
405
|
# Allows the setting of how much memory to dedicate to the solr ram buffer. This defaults to 2000MB
|
402
|
-
#
|
403
|
-
# are using DSE prior to 4.7) you should set this to something more reasonable like 100MB.
|
406
|
+
# when live indexing is enabled. Otherwise the default is 100MB.
|
404
407
|
class_attribute :ram_buffer_size
|
405
|
-
|
408
|
+
|
409
|
+
# Allows the setting of what lucene version (and bugs) data should be indexed with.
|
410
|
+
# Defaults to LUCENE_46.
|
411
|
+
class_attribute :lucene_match_version
|
412
|
+
self.lucene_match_version = 'LUCENE_46'
|
406
413
|
|
407
414
|
# Stores the attribute that wide models should cluster on. Basically, this is the
|
408
415
|
# attribute that CQL uses to "group" columns into logical records even though they
|
@@ -466,7 +466,7 @@ module DatastaxRails
|
|
466
466
|
|
467
467
|
q = @fulltext_values.empty? ? '*:*' : @fulltext_values.map { |ftv| '(' + ftv[:query] + ')' }.join(' AND ')
|
468
468
|
|
469
|
-
params = { q: q }
|
469
|
+
params = { q: q, commit: true }
|
470
470
|
params[:sort] = sort
|
471
471
|
params[:fq] = filter_queries unless filter_queries.empty?
|
472
472
|
if @query_parser_value
|
@@ -41,7 +41,7 @@ module DatastaxRails
|
|
41
41
|
def reindex_solr(model, destructive = false)
|
42
42
|
url = "#{DatastaxRails::Base.solr_base_url}/admin/cores?action=RELOAD&name=#{DatastaxRails::Base.config[:keyspace]}.#{model.column_family}&reindex=true&deleteAll=#{destructive}"
|
43
43
|
say "Posting reindex command to '#{url}'", :subitem
|
44
|
-
`curl -s -X POST '#{url}'`
|
44
|
+
`curl -s -X POST '#{url}' -H 'Content-type:text/xml; charset=utf-8'`
|
45
45
|
say 'Reindexing will run in the background', :subitem
|
46
46
|
end
|
47
47
|
|
@@ -50,7 +50,7 @@ module DatastaxRails
|
|
50
50
|
def create_solr_core(model)
|
51
51
|
url = "#{DatastaxRails::Base.solr_base_url}/admin/cores?action=CREATE&name=#{DatastaxRails::Base.config[:keyspace]}.#{model.column_family}"
|
52
52
|
say "Posting create command to '#{url}'", :subitem
|
53
|
-
`curl -s -X POST '#{url}'`
|
53
|
+
`curl -s -X POST '#{url}' -H 'Content-type:text/xml; charset=utf-8'`
|
54
54
|
end
|
55
55
|
|
56
56
|
# Uploads the necessary configuration files for solr to function
|
@@ -62,12 +62,14 @@ module DatastaxRails
|
|
62
62
|
# TODO: Simplify this method
|
63
63
|
def upload_solr_configuration(model, force = false, reindex = true) # rubocop:disable all
|
64
64
|
count = 0
|
65
|
+
@live_indexing = model.live_indexing
|
66
|
+
@solr_commit_time = model.solr_commit_time || (@live_indexing ? '1000' : '5000')
|
67
|
+
@ram_buffer_size = model.ram_buffer_size || (@live_indexing ? '2000' : '100')
|
68
|
+
@lucene_match_version = model.lucene_match_version
|
65
69
|
if Rails.root.join('config', 'solr', "#{model.column_family}-solrconfig.xml").exist?
|
66
70
|
say 'Using custom solrconfig file', :subitem
|
67
|
-
solrconfig = Rails.root.join('config', 'solr', "#{model.column_family}-solrconfig.xml").read
|
71
|
+
solrconfig = ERB.new(Rails.root.join('config', 'solr', "#{model.column_family}-solrconfig.xml").read).result(binding)
|
68
72
|
else
|
69
|
-
@solr_commit_time = model.solr_commit_time
|
70
|
-
@ram_buffer_size = model.ram_buffer_size
|
71
73
|
solrconfig = ERB.new(File.read(File.join(File.dirname(__FILE__), '..', '..', '..', 'config', 'solrconfig.xml.erb'))).result(binding)
|
72
74
|
end
|
73
75
|
if Rails.root.join('config', 'solr', "#{model.column_family}-stopwords.txt").exist?
|
@@ -104,7 +106,7 @@ module DatastaxRails
|
|
104
106
|
count += 1
|
105
107
|
loop do
|
106
108
|
say "Posting Solr Config file to '#{solr_url}/solrconfig.xml'", :subitem
|
107
|
-
http.post(uri.path + '/solrconfig.xml', solrconfig)
|
109
|
+
http.post(uri.path + '/solrconfig.xml', solrconfig, 'Content-type' => 'text/xml; charset=utf-8')
|
108
110
|
if Rails.env.production?
|
109
111
|
sleep(5)
|
110
112
|
resp = http.get(uri.path + '/solrconfig.xml')
|
@@ -118,7 +120,7 @@ module DatastaxRails
|
|
118
120
|
count += 1
|
119
121
|
loop do
|
120
122
|
say "Posting Solr Stopwords file to '#{solr_url}/stopwords.txt'", :subitem
|
121
|
-
http.post(uri.path + '/stopwords.txt', stopwords)
|
123
|
+
http.post(uri.path + '/stopwords.txt', stopwords, 'Content-type' => 'text/xml; charset=utf-8')
|
122
124
|
if Rails.env.production?
|
123
125
|
sleep(5)
|
124
126
|
resp = http.get(uri.path + '/stopwords.txt')
|
@@ -132,7 +134,7 @@ module DatastaxRails
|
|
132
134
|
count += 1
|
133
135
|
loop do
|
134
136
|
say "Posting Solr Schema file to '#{solr_url}/schema.xml'", :subitem
|
135
|
-
http.post(uri.path + '/schema.xml', schema)
|
137
|
+
http.post(uri.path + '/schema.xml', schema, 'Content-type' => 'text/xml; charset=utf-8')
|
136
138
|
if Rails.env.production?
|
137
139
|
sleep(5)
|
138
140
|
resp = http.get(uri.path + '/schema.xml')
|
data/spec/dummy/log/test.log
CHANGED
@@ -589,3 +589,12 @@
|
|
589
589
|
[1m[36mTeamMetadata CQL (7.7ms)[0m [1mINSERT INTO dynamic_model (group,id,s_,d_) VALUES (?,?,?,?) [0m ["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
590
|
[1m[35mCoreMetadata Search (4.4ms)[0m {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
591
|
[1m[36mCoreMetadata Search (32.3ms)[0m [1m{q: "(tv)", sort: "", fq: ["group:(core)"], fl: "id,group,s_*,t_*,b_*,d_*,l_*,db_*,ts_*,i_*,f_*,u_*", page: 1, per_page: 100000}[0m
|
592
|
+
[1m[36mPersonRole Search (3.8ms)[0m [1m{q: "*:*", sort: "", fq: ["person_id:(4b7bed5e-2a45-11e5-8a5d-1be499a854eb)"], fl: "id,person_id,role_id,created_at,updated_at", page: 1, per_page: 100000}[0m
|
593
|
+
[1m[35mRole CQL (4.3ms)[0m SELECT id,name,created_at,updated_at FROM roles WHERE "id" IN (?,?) LIMIT 100000 [#<Cassandra::TimeUuid:0x007f3288bd56e8 @n=100343444245272480166332369569408290340>, #<Cassandra::TimeUuid:0x007f3288bd5468 @n=100357660154472414617096357815357548456>] - 2 results
|
594
|
+
[1m[36mPerson Search (3.5ms)[0m [1m{q: "*:*", sort: "", fq: ["sort_name:(steve)"], fl: "id", page: 1, per_page: 1}[0m
|
595
|
+
[1m[35mPerson CQL (3.8ms)[0m INSERT INTO people (name,str_,created_at,updated_at,id) VALUES (?,?,?,?,?) ["Steve", {"str_favorite_color"=>"blue"}, 2015-07-14 16:28:06 UTC, 2015-07-14 16:28:06 UTC, #<Cassandra::TimeUuid:0x007f3288c126b0 @n=104753604644874615968050975373676543666>] - 0 results
|
596
|
+
[1m[36mPerson Search (5.1ms)[0m [1m{q: "*:*", sort: "", fq: ["str_favorite_color:(blue)"], fl: "id,name,birthdate,nickname,email_addresses,str_*,created_at,updated_at", page: 1, per_page: 100000}[0m
|
597
|
+
[1m[35mCoreMetadata CQL (4.1ms)[0m INSERT INTO dynamic_model (group,s_,ts_,id) VALUES (?,?,?,?) ["core", {"s_source"=>"BBC", "s_author"=>"John"}, {"ts_published_at"=>2015-07-14 16:28:08 UTC}, #<Cassandra::TimeUuid:0x007f3288c7ada0 @n=105958403543780279470681916281545570196>] - 0 results
|
598
|
+
[1m[36mTeamMetadata CQL (3.7ms)[0m [1mINSERT INTO dynamic_model (group,id,s_,d_) VALUES (?,?,?,?) [0m ["team", #<Cassandra::TimeUuid:0x007f3288cc3d98 @n=105958403543780279470681916281545570196>, {"s_source"=>"TV", "s_medium"=>"television"}, {"d_published_on"=>2015-07-14 00:00:00 UTC}] - 0 results
|
599
|
+
[1m[35mCoreMetadata Search (4.8ms)[0m {q: "(bbc)", sort: "", fq: ["group:(core)"], fl: "id,group,s_*,t_*,b_*,d_*,l_*,db_*,ts_*,i_*,f_*,u_*", page: 1, per_page: 100000}
|
600
|
+
[1m[36mCoreMetadata Search (20.7ms)[0m [1m{q: "(tv)", sort: "", fq: ["group:(core)"], fl: "id,group,s_*,t_*,b_*,d_*,l_*,db_*,ts_*,i_*,f_*,u_*", page: 1, per_page: 100000}[0m
|
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.4.
|
4
|
+
version: 2.4.4
|
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-
|
11
|
+
date: 2015-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|