ebsco-eds 0.3.4.pre → 0.3.5.pre

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5892ad55aa81cd0c31eafcc91a87de4b81483dc
4
- data.tar.gz: 7fc2bd988dd215d75e37a9cf3e33b1b9089bb936
3
+ metadata.gz: b01d52fab1ebf5ad7dff691dc253ae50fef72e97
4
+ data.tar.gz: ce5af9c7d9ad9a251964b555518a170d8319f226
5
5
  SHA512:
6
- metadata.gz: d557e0ce5b0af80aaed93bb459d1ec14cea8d8bbf94af47db09f80b7321949c5f6842ac19541e1f5f2d04034d73db693ed9e6bc2a01c1f56a041a90f72a313d5
7
- data.tar.gz: 6090a2e9243e7996ad50206902ff17bba0b634c4fa21ef421c9fa7e9f3320a7c9619e45f9650e52fcf5053d7596b7884224c50088238fd1b2b4cd745852231ec
6
+ metadata.gz: 79d7be540a8d86ad94311655d3dd132cd4d39cc34f98241cc9a0284725f4ba0c38681ab5fe062be3bd059c721dad704ef896fa214502ed2bfe385b29c7c22b07
7
+ data.tar.gz: c21bddfbcca4af8ee6e7a1b4f914fdca7cf1f201454d145d74693baf81006a6f19114521c75ac9fb1c55ff2878875d685004496e6cfb8bf81ca6d1989a817aa6
@@ -218,7 +218,7 @@ module EBSCO
218
218
  end
219
219
 
220
220
  def eds_sanitize(str)
221
- pattern = /(\'|\"|\*|\/|\-|\\|\)|\$|\+|\(|\^|\?|\!|\~|\`|\:)/
221
+ pattern = /(\'|\"|\*|\/|\\|\)|\$|\+|\(|\^|\?|\!|\~|\`|\:)/
222
222
  str = str.gsub(pattern){ |match| '\\' + match }
223
223
  str
224
224
  end
@@ -23,6 +23,9 @@ module EBSCO
23
23
 
24
24
  attr_reader :raw_options
25
25
 
26
+ attr_accessor :temp_format_facet_results
27
+ attr_accessor :temp_content_provider_facet_results
28
+
26
29
  # Creates search results from the \EDS API search response. It includes information about the results and a list
27
30
  # of Record items.
28
31
  def initialize(search_results, additional_limiters = {}, options = {})
@@ -472,7 +475,13 @@ module EBSCO
472
475
  # ]
473
476
  def facets (facet_provided_id = 'all')
474
477
  facets_hash = []
475
- available_facets = @results.fetch('SearchResult',{}).fetch('AvailableFacets',{})
478
+
479
+ if temp_format_facet_results.nil?
480
+ available_facets = @results.fetch('SearchResult',{}).fetch('AvailableFacets',{})
481
+ else
482
+ available_facets = temp_format_facet_results.results.fetch('SearchResult',{}).fetch('AvailableFacets',{})
483
+ end
484
+
476
485
  available_facets.each do |available_facet|
477
486
  if available_facet['Id'] == facet_provided_id || facet_provided_id == 'all'
478
487
  facet_label = available_facet['Label']
@@ -493,6 +502,14 @@ module EBSCO
493
502
  def solr_facets (facet_provided_id = 'all')
494
503
  facet_values = []
495
504
  available_facets = @results.fetch('SearchResult',{}).fetch('AvailableFacets',{})
505
+
506
+ if facet_provided_id == 'SourceType' && !temp_format_facet_results.nil?
507
+ available_facets = temp_format_facet_results.results.fetch('SearchResult',{}).fetch('AvailableFacets',{})
508
+ end
509
+ if facet_provided_id == 'ContentProvider' && !temp_content_provider_facet_results.nil?
510
+ available_facets = temp_content_provider_facet_results.results.fetch('SearchResult',{}).fetch('AvailableFacets',{})
511
+ end
512
+
496
513
  available_facets.each do |available_facet|
497
514
  if available_facet['Id'] == facet_provided_id || facet_provided_id == 'all'
498
515
  available_facet['AvailableFacetValues'].each do |available_facet_value|
@@ -211,8 +211,32 @@ module EBSCO
211
211
  if @search_options.nil? || !add_actions
212
212
  @search_options = EBSCO::EDS::Options.new(options, @info)
213
213
  end
214
+
214
215
  _response = do_request(:post, path: '/edsapi/rest/Search', payload: @search_options)
215
216
  @search_results = EBSCO::EDS::Results.new(_response, @info.available_limiters, options)
217
+
218
+ # create temp format facet results if needed
219
+ if options['f']
220
+ if options['f'].key?('eds_publication_type_facet')
221
+ format_options = options
222
+ format_options['f'] = options['f'].except('eds_publication_type_facet')
223
+ format_search_options = EBSCO::EDS::Options.new(format_options, @info)
224
+ _format_response = do_request(:post, path: '/edsapi/rest/Search', payload: format_search_options)
225
+ @search_results.temp_format_facet_results = EBSCO::EDS::Results.new(_format_response, @info.available_limiters, format_options)
226
+ end
227
+ end
228
+
229
+ # create temp content provider facet results if needed
230
+ if options['f']
231
+ if options['f'].key?('eds_content_provider_facet')
232
+ content_options = options
233
+ content_options['f'] = options['f'].except('eds_content_provider_facet')
234
+ content_search_options = EBSCO::EDS::Options.new(content_options, @info)
235
+ _content_response = do_request(:post, path: '/edsapi/rest/Search', payload: content_search_options)
236
+ @search_results.temp_content_provider_facet_results = EBSCO::EDS::Results.new(_content_response, @info.available_limiters, content_options)
237
+ end
238
+ end
239
+
216
240
  if increment_page
217
241
  @current_page = @search_results.page_number
218
242
  end
@@ -866,7 +890,7 @@ module EBSCO
866
890
  end
867
891
 
868
892
  def eds_sanitize(str)
869
- pattern = /(\'|\"|\*|\/|\-|\\|\)|\$|\+|\(|\^|\?|\!|\~|\`|\:)/
893
+ pattern = /(\'|\"|\*|\/|\\|\)|\$|\+|\(|\^|\?|\!|\~|\`|\:)/
870
894
  str = str.gsub(pattern){ |match| '\\' + match }
871
895
  str
872
896
  end
@@ -1,5 +1,5 @@
1
1
  module EBSCO
2
2
  module EDS
3
- VERSION = '0.3.4.pre'
3
+ VERSION = '0.3.5.pre'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ebsco-eds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4.pre
4
+ version: 0.3.5.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill McKinney
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-08-25 00:00:00.000000000 Z
12
+ date: 2017-08-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday