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 +4 -4
- data/README.md +27 -0
- data/lib/tasks/uri_service/solr.rake +3 -1
- data/lib/uri_service/client.rb +7 -1
- data/lib/uri_service/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b9a35571ee084f6df8f3a1e939d70ae6aabbcc1
|
4
|
+
data.tar.gz: 955d2932eeb4c58d211366072507ff09f9b9cea5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
7
|
+
clear = (ENV['CLEAR'].to_s == 'true')
|
8
|
+
|
9
|
+
UriService.client.reindex_all_terms(clear, true)
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
data/lib/uri_service/client.rb
CHANGED
@@ -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(
|
data/lib/uri_service/version.rb
CHANGED