uri_service 0.2.5 → 0.2.6
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.
- checksums.yaml +4 -4
- data/lib/uri_service/client.rb +15 -3
- data/lib/uri_service/version.rb +1 -1
- metadata +1 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 845187ba683b261e1633154472f1d014ec54427f
|
4
|
+
data.tar.gz: 8796fb9f981396e0850b25f44b63807b74d58140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 373950826a7bd03c9ec44b0809d6ec777349da1271313fc9a87368381f9e5dae18bfb45240727b44eab24d1a5e87dbab82a2b090bdaf425e53c157a3a936da8a
|
7
|
+
data.tar.gz: 6a5ae8b0ca6a7515465ffefd41271a9235b8694d7c5153f9cc18b982f5fd76bef028908d421e6dca7190aeabb82983588246e8c716841cf89e1928c3e7ba5c0a
|
data/lib/uri_service/client.rb
CHANGED
@@ -290,9 +290,20 @@ class UriService::Client
|
|
290
290
|
end
|
291
291
|
end
|
292
292
|
|
293
|
-
|
293
|
+
# Finds the first term matching the specified conditions
|
294
|
+
def find_term_by(opts)
|
295
|
+
fqs = []
|
296
|
+
|
297
|
+
# Only search on allowed fields
|
298
|
+
unsupported_search_fields = opts.map{|key, val| key.to_s} - CORE_FIELD_NAMES
|
299
|
+
raise UriService::UnsupportedSearchFieldError, "Unsupported search fields: #{unsupported_search_fields.join(', ')}" if unsupported_search_fields.present?
|
300
|
+
|
301
|
+
opts.each do |field_name, val|
|
302
|
+
fqs << (field_name.to_s + ':"' + UriService.solr_escape(val.to_s) + '"')
|
303
|
+
end
|
304
|
+
|
294
305
|
@rsolr_pool.with do |rsolr|
|
295
|
-
response = rsolr.get('select', params: {
|
306
|
+
response = rsolr.get('select', params: {:q => '*:*', :fq => fqs })
|
296
307
|
if response['response']['numFound'] == 1
|
297
308
|
return term_solr_doc_to_frozen_term_hash(response['response']['docs'].first)
|
298
309
|
end
|
@@ -474,4 +485,5 @@ class UriService::ExistingUriError < StandardError;end
|
|
474
485
|
class UriService::ExistingVocabularyStringKeyError < StandardError;end
|
475
486
|
class UriService::NonExistentUriError < StandardError;end
|
476
487
|
class UriService::NonExistentVocabularyError < StandardError;end
|
477
|
-
class UriService::UnsupportedObjectTypeError < StandardError;end
|
488
|
+
class UriService::UnsupportedObjectTypeError < StandardError;end
|
489
|
+
class UriService::UnsupportedSearchFieldError < StandardError;end
|
data/lib/uri_service/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric O'Hanlon
|
@@ -202,4 +202,3 @@ specification_version: 4
|
|
202
202
|
summary: A service for registering local URIs and performing both local and remote
|
203
203
|
URI lookups.
|
204
204
|
test_files: []
|
205
|
-
has_rdoc:
|