uri_service 0.2.9 → 0.2.10

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: 4b458df27c7aeead867b7428323c726280b3665a
4
- data.tar.gz: a792e2a0d892e8a31769e5f259088cdcf6c4d9b0
3
+ metadata.gz: 6b9a35571ee084f6df8f3a1e939d70ae6aabbcc1
4
+ data.tar.gz: 955d2932eeb4c58d211366072507ff09f9b9cea5
5
5
  SHA512:
6
- metadata.gz: 1c68e9eb488225cdc1756bbf32995c933d0b4884895f52c8c6debb8c402cca1153382fcfa75f9cf8238264fd084021e7a866bcf12c47ff22b1b50bb95e5815d4
7
- data.tar.gz: 252acdb96ff30482a8f5c21e200dc311b9188a2490c9176cfe00e5a7b03c6addb9f175118a86bacad3162fb7d4005470a2fe8d904ee8c1aa17983fb7193f7d13
6
+ metadata.gz: e06581903fc304e93b8c2de61c25e767d95ec7ba7f3d8e2eb776e40d174b6ad574397ba55f74ee56dca6b411cac9fdb40d3821af6129fecd414bef5408b8ba35
7
+ data.tar.gz: 0ff48db084c9f017b9cdc12c7444551c2af49cec947fe191d9047ea555c242b0fd51630ae7f5a135bf47270859674e5c741cc49b91aa4011f99972475f29effc
data/README.md CHANGED
@@ -166,6 +166,33 @@ start = 0
166
166
  UriService.client.list_terms('names', limit, start)
167
167
  ```
168
168
 
169
+ ### Rake Tasks for Rails:
170
+
171
+ Setup required database tables:
172
+ ```sh
173
+ bundle exec rake uri_service:db:setup
174
+ ```
175
+
176
+ Also available outside of Rails as:
177
+
178
+ ```ruby
179
+ UriService.client.create_required_tables
180
+ ```
181
+
182
+ Reindex all database terms into Solr:
183
+ ```sh
184
+ bundle exec rake uri_service:solr:reindex_all_terms # Reindex all terms in the database
185
+
186
+ bundle exec rake uri_service:solr:reindex_all_terms CLEAR=true # Clear solr index before reindexing all terms (to remove old terms)
187
+ ```
188
+
189
+ Also available outside of Rails as:
190
+
191
+ ```ruby
192
+ UriService.client.reindex_all_terms(false, false) # Reindex
193
+ UriService.client.reindex_all_terms(true, false) # Clear solr index and reindex
194
+ ```
195
+
169
196
  ### Running Integration Tests (for developers):
170
197
 
171
198
  Integration tests are great and we should run them. Here's how:
@@ -4,7 +4,9 @@ namespace :uri_service do
4
4
  if defined?(Rails)
5
5
  desc "Reindex all terms"
6
6
  task :reindex_all_terms => :environment do
7
- UriService.client.reindex_all_terms(true)
7
+ clear = (ENV['CLEAR'].to_s == 'true')
8
+
9
+ UriService.client.reindex_all_terms(clear, true)
8
10
  end
9
11
  end
10
12
 
@@ -21,7 +21,7 @@ class UriService::Client
21
21
  @rsolr_pool = ConnectionPool.new( size: opts['solr']['pool_size'], timeout: (opts['solr']['pool_timeout'].to_f/1000.to_f) ) { RSolr.connect(:url => opts['solr']['url']) }
22
22
  end
23
23
 
24
- def reindex_all_terms(print_progress_to_console=false)
24
+ def reindex_all_terms(clear=false, print_progress_to_console=false)
25
25
  self.handle_database_disconnect do
26
26
 
27
27
  if print_progress_to_console
@@ -32,6 +32,12 @@ class UriService::Client
32
32
  puts ""
33
33
  end
34
34
 
35
+ if clear
36
+ @rsolr_pool.with do |rsolr|
37
+ rsolr.delete_by_query('*:*');
38
+ end
39
+ end
40
+
35
41
  # Need to use unambiguous order when using paged_each
36
42
  @db[UriService::TERMS].order(:id).paged_each(:rows_per_fetch=>100) do |term_db_row|
37
43
  self.send_term_to_solr(
@@ -1,6 +1,6 @@
1
1
  module UriService
2
2
 
3
- VERSION = '0.2.9'
3
+ VERSION = '0.2.10'
4
4
 
5
5
  def self.version
6
6
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uri_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric O'Hanlon