Class: EBSCO::EDS::Results
- Inherits:
-
Object
- Object
- EBSCO::EDS::Results
- Defined in:
- lib/ebsco/eds/results.rb
Overview
Search Results
Instance Attribute Summary collapse
-
#publication_match ⇒ Object
readonly
Array of EBSCO::EDS::Record Exact Publication Matches.
-
#raw_options ⇒ Object
readonly
Returns the value of attribute raw_options.
-
#records ⇒ Object
Array of EBSCO::EDS::Record results.
-
#research_starters ⇒ Object
readonly
Array of EBSCO::EDS::Record Research Starters.
-
#results ⇒ Object
Raw results as Hash.
-
#smarttext_failover ⇒ Object
readonly
Bool.
-
#stat_total_hits ⇒ Object
Total number of results found.
-
#temp_content_provider_facet_results ⇒ Object
Returns the value of attribute temp_content_provider_facet_results.
-
#temp_format_facet_results ⇒ Object
Returns the value of attribute temp_format_facet_results.
Instance Method Summary collapse
-
#applied_expanders ⇒ Object
Expanders applied to the search.
-
#applied_facets ⇒ Object
List of facets applied to the search.
-
#applied_limiters ⇒ Object
List of limiters applied to the search.
-
#applied_publications ⇒ Object
Publications search was limited to.
- #auto_corrections ⇒ Object
-
#database_stats ⇒ Object
Provides a list of databases searched and the number of hits found in each one.
-
#date_range ⇒ Object
Returns a hash of the date range available for the search.
-
#did_you_mean ⇒ Object
Provides alternative search terms to correct spelling, etc.
-
#facets(facet_provided_id = 'all') ⇒ Object
Provides a list of facets for the search results.
-
#initialize(search_results, eds_config = {}, additional_limiters = {}, options = {}, smarttext_failover = false) ⇒ Results
constructor
Creates search results from the EDS API search response.
-
#page_number ⇒ Object
Current page number for the results.
-
#results_per_page ⇒ Object
Results per page.
-
#retrieval_criteria ⇒ Object
Retrieval criteria that was applied to the search.
-
#search_criteria ⇒ Object
Search criteria used in the search Returns a hash.
-
#search_criteria_with_actions ⇒ Object
Search criteria actions applied.
-
#search_queries ⇒ Object
Queries used to produce the results.
-
#search_terms ⇒ Object
Returns a simple list of the search terms used.
- #solr_facets(facet_provided_id = 'all') ⇒ Object
-
#solr_pub_date_facets ⇒ Object
Publication date facets: - This year - Last 3 years - Last 10 years - Last 50 years - More than 50 years ago.
-
#solr_search_limiters ⇒ Object
Translate limiters found in calls to Info endpoint into solr facet fields if they are turned on.
-
#solr_spellcheck ⇒ Object
Example:.
-
#stat_total_time ⇒ Object
Time it took to complete the search in milliseconds.
-
#to_solr ⇒ Object
returns solr search response format.
Constructor Details
#initialize(search_results, eds_config = {}, additional_limiters = {}, options = {}, smarttext_failover = false) ⇒ Results
Creates search results from the EDS API search response. It includes information about the results and a list of Record items.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/ebsco/eds/results.rb', line 34 def initialize(search_results, eds_config = {}, additional_limiters = {}, = {}, smarttext_failover = false) @results = search_results if @results.is_a?(Hash) @limiters = additional_limiters = # titleize facets? (ENV.has_key? 'EDS_TITLEIZE_FACETS') ? if %w(y Y yes Yes true True).include?(ENV['EDS_TITLEIZE_FACETS']) @titleize_facets_on = true else @titleize_facets_on = false end : @titleize_facets_on = eds_config[:titleize_facets] # convert all results to a list of records @records = [] if @results['SearchResult']['Data']['Records'] @results['SearchResult']['Data']['Records'].each { |record| @records.push(EBSCO::EDS::Record.new(record, eds_config)) # # records hidden in guest mode # if record['Header']['AccessLevel'] # if record['Header']['AccessLevel'].to_i > 1 # @records.push(EBSCO::EDS::Record.new(record)) # else # @records.push(EBSCO::EDS::Record.new(record)) # end # else # @records.push(EBSCO::EDS::Record.new(record)) # end } end # create a special list of research starter records @research_starters = [] = @results.fetch('SearchResult',{}).fetch('RelatedContent',{}).fetch('RelatedRecords',{}) if .count > 0 .each do || if ['Type'] == 'rs' rs_entries = .fetch('Records',{}) if rs_entries.count > 0 rs_entries.each do |rs_record| @research_starters.push(EBSCO::EDS::Record.new(rs_record, eds_config)) end end end end end # create a special list of exact match publications @publication_match = [] = @results.fetch('SearchResult',{}).fetch('RelatedContent',{}).fetch('RelatedPublications',{}) if .count > 0 .each do || if ['Type'] == 'emp' _publication_matches = .fetch('PublicationRecords',{}) if _publication_matches.count > 0 _publication_matches.each do |publication_record| @publication_match.push(EBSCO::EDS::Record.new(publication_record, eds_config)) end end end end end # titleize facets @titleize_facets = %w[Language Journal SubjectEDS SubjectGeographic Publisher] # set flag that query was rerun with smarttext after no results were found @smarttext_failover = smarttext_failover else # response isn't a hash (eg, html error page) raise EBSCO::EDS::ApiError, 'EBSCO API error: Query failed.' end end |
Instance Attribute Details
#publication_match ⇒ Object (readonly)
Array of EBSCO::EDS::Record Exact Publication Matches
23 24 25 |
# File 'lib/ebsco/eds/results.rb', line 23 def publication_match @publication_match end |
#raw_options ⇒ Object (readonly)
Returns the value of attribute raw_options.
27 28 29 |
# File 'lib/ebsco/eds/results.rb', line 27 def end |
#records ⇒ Object
Array of EBSCO::EDS::Record results
17 18 19 |
# File 'lib/ebsco/eds/results.rb', line 17 def records @records end |
#research_starters ⇒ Object (readonly)
Array of EBSCO::EDS::Record Research Starters
19 20 21 |
# File 'lib/ebsco/eds/results.rb', line 19 def research_starters @research_starters end |
#results ⇒ Object
Raw results as Hash
15 16 17 |
# File 'lib/ebsco/eds/results.rb', line 15 def results @results end |
#smarttext_failover ⇒ Object (readonly)
Bool
21 22 23 |
# File 'lib/ebsco/eds/results.rb', line 21 def smarttext_failover @smarttext_failover end |
#stat_total_hits ⇒ Object
Total number of results found.
324 325 326 |
# File 'lib/ebsco/eds/results.rb', line 324 def stat_total_hits @stat_total_hits end |
#temp_content_provider_facet_results ⇒ Object
Returns the value of attribute temp_content_provider_facet_results.
30 31 32 |
# File 'lib/ebsco/eds/results.rb', line 30 def temp_content_provider_facet_results @temp_content_provider_facet_results end |
#temp_format_facet_results ⇒ Object
Returns the value of attribute temp_format_facet_results.
29 30 31 |
# File 'lib/ebsco/eds/results.rb', line 29 def temp_format_facet_results @temp_format_facet_results end |
Instance Method Details
#applied_expanders ⇒ Object
Expanders applied to the search.
Example
[
{"Id"=>"fulltext", "RemoveAction"=>"removeexpander(fulltext)"},
{"Id"=>"thesaurus", "RemoveAction"=>"removeexpander(thesaurus)"},
{"Id"=>"relatedsubjects", "RemoveAction"=>"removeexpander(relatedsubjects)"}
]
460 461 462 463 464 465 466 467 |
# File 'lib/ebsco/eds/results.rb', line 460 def af = [] = @results['SearchRequest'].fetch('SearchCriteriaWithActions',{}).fetch('ExpandersWithAction',{}) .each do |applied_explander| af.push(applied_explander) end af end |
#applied_facets ⇒ Object
List of facets applied to the search.
Example
[{
"FacetValue"=>{"Id"=>"SubjectGeographic", "Value"=>"massachusetts"},
"RemoveAction"=>"removefacetfiltervalue(1,SubjectGeographic:massachusetts)"
}]
426 427 428 429 430 431 432 433 434 435 |
# File 'lib/ebsco/eds/results.rb', line 426 def applied_facets af = [] applied_facets_section = @results['SearchRequest'].fetch('SearchCriteriaWithActions',{}).fetch('FacetFiltersWithAction',{}) applied_facets_section.each do |applied_facets| applied_facets.fetch('FacetValuesWithAction',{}).each do |applied_facet| af.push(applied_facet) end end af end |
#applied_limiters ⇒ Object
List of limiters applied to the search.
Example
[{
"Id"=>"LA99",
"LimiterValuesWithAction"=>[{"Value"=>"French", "RemoveAction"=>"removelimitervalue(LA99:French)"}],
"RemoveAction"=>"removelimiter(LA99)"
}]
444 445 446 447 448 449 450 451 |
# File 'lib/ebsco/eds/results.rb', line 444 def applied_limiters af = [] applied_limters_section = @results['SearchRequest'].fetch('SearchCriteriaWithActions',{}).fetch('LimitersWithAction',{}) applied_limters_section.each do |applied_limter| af.push(applied_limter) end af end |
#applied_publications ⇒ Object
Publications search was limited to.
Example
[
["Id", "eric"],
["RemoveAction", "removepublication(eric)"]
]
475 476 477 478 479 480 481 482 |
# File 'lib/ebsco/eds/results.rb', line 475 def applied_publications retval = [] applied_publications_section = @results['SearchRequest'].fetch('SearchCriteriaWithActions',{}).fetch('PublicationWithAction',{}) applied_publications_section.each do |item| retval.push(item) end retval end |
#auto_corrections ⇒ Object
616 617 618 619 620 621 622 |
# File 'lib/ebsco/eds/results.rb', line 616 def auto_corrections auto_corrected_terms = @results.fetch('SearchResult', {}).fetch('AutoCorrectedTerms',{}) auto_corrected_terms.each do |term| return term end nil end |
#database_stats ⇒ Object
Provides a list of databases searched and the number of hits found in each one.
Example
[
{:id=>"nlebk", :hits=>0, :label=>"eBook Collection (EBSCOhost)"},
{:id=>"e000xna", :hits=>30833, :label=>"eBook Academic Collection (EBSCOhost)"},
{:id=>"edsart", :hits=>8246, :label=>"ARTstor Digital Library"},
{:id=>"e700xna", :hits=>6701, :label=>"eBook Public Library Collection (EBSCOhost)"},
{:id=>"cat02060a", :hits=>3464, :label=>"EDS Demo Catalog – US - U of Georgia"},
{:id=>"ers", :hits=>1329, :label=>"Research Starters"},
{:id=>"asn", :hits=>136406, :label=>"Academic Search Ultimate"}
]
495 496 497 498 499 500 501 502 503 |
# File 'lib/ebsco/eds/results.rb', line 495 def database_stats databases = [] databases_facet = @results['SearchResult']['Statistics']['Databases'] databases_facet.each do |database| db_label = database['Label'] databases.push({id: database['Id'], hits: database['Hits'], label: db_label}) end databases end |
#date_range ⇒ Object
Returns a hash of the date range available for the search.
Example
{:mindate=>"1501-01", :maxdate=>"2018-04", :minyear=>"1501", :maxyear=>"2018"}
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 |
# File 'lib/ebsco/eds/results.rb', line 587 def date_range mindate = @results['SearchResult']['AvailableCriteria']['DateRange']['MinDate'] maxdate = @results['SearchResult']['AvailableCriteria']['DateRange']['MaxDate'] minyear = mindate[0..3] maxyear = maxdate[0..3] # cap maxdate/maxyear to current year + 1 (to filter any erroneous database metadata) current_year = Time.new.year if maxyear.to_i > current_year maxyear = current_year + 1 maxdate = (current_year + 1).to_s + '-01' end {mindate: mindate.to_s, maxdate: maxdate.to_s, minyear:minyear.to_s, maxyear:maxyear.to_s} end |
#did_you_mean ⇒ Object
Provides alternative search terms to correct spelling, etc.
Example
results = session.simple_search('earthquak')
results.did_you_mean
=> "earthquake"
608 609 610 611 612 613 614 |
# File 'lib/ebsco/eds/results.rb', line 608 def did_you_mean dym_suggestions = @results.fetch('SearchResult', {}).fetch('AutoSuggestedTerms',{}) dym_suggestions.each do |term| return term end nil end |
#facets(facet_provided_id = 'all') ⇒ Object
Provides a list of facets for the search results.
Example
[
{
:id=>"SourceType",
:label=>"Source Type",
:values=>[
{
:value=>"Academic Journals",
:hitcount=>147,
:action=>"addfacetfilter(SourceType:Academic Journals)"
},
{
:value=>"News",
:hitcount=>111,
:action=>"addfacetfilter(SourceType:News)"
},
...
}
]
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
# File 'lib/ebsco/eds/results.rb', line 527 def facets (facet_provided_id = 'all') facets_hash = [] if temp_format_facet_results.nil? available_facets = @results.fetch('SearchResult',{}).fetch('AvailableFacets',{}) else available_facets = temp_format_facet_results.results.fetch('SearchResult',{}).fetch('AvailableFacets',{}) end available_facets.each do |available_facet| if available_facet['Id'] == facet_provided_id || facet_provided_id == 'all' facet_label = available_facet['Label'] facet_id = available_facet['Id'] facet_values = [] available_facet['AvailableFacetValues'].each do |available_facet_value| facet_value = available_facet_value['Value'] if @titleize_facets_on and @titleize_facets.include?(facet_id) title = EBSCO::EDS::Titleize.new facet_value = title.titleize(facet_value) end facet_count = available_facet_value['Count'] facet_action = available_facet_value['AddAction'] facet_values.push({value: facet_value, hitcount: facet_count, action: facet_action}) end facets_hash.push(id: facet_id, label: facet_label, values: facet_values) end end facets_hash end |
#page_number ⇒ Object
Current page number for the results. Returns an integer.
411 412 413 |
# File 'lib/ebsco/eds/results.rb', line 411 def page_number retrieval_criteria['PageNumber'] end |
#results_per_page ⇒ Object
Results per page. Returns an integer.
416 417 418 |
# File 'lib/ebsco/eds/results.rb', line 416 def results_per_page retrieval_criteria['ResultsPerPage'] || 20 end |
#retrieval_criteria ⇒ Object
Retrieval criteria that was applied to the search. Returns a hash.
Example
{"View"=>"brief", "ResultsPerPage"=>20, "PageNumber"=>1, "Highlight"=>"y"}
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/ebsco/eds/results.rb', line 380 def retrieval_criteria # GET METHOD: requires the hash to be built from scratch rc = {} if @results['SearchRequestGet'] if @results['SearchRequestGet']['QueryString'] params = CGI::parse(@results['SearchRequestGet']['QueryString']) rc['PageNumber'] = params['pagenumber'].nil? ? 1 : params['pagenumber'][0].to_i rc['ResultsPerPage'] = params['resultsperpage'].nil? ? 20 : params['resultsperpage'][0].to_i rc['Highlight'] = params['highlight'].nil? ? 'n' : params['highlight'][0].to_s rc['View'] = params['view'].nil? ? 'brief' : params['view'][0].to_s end else if @results['SearchRequest'] if @results['SearchRequest']['RetrievalCriteria'] rc = @results['SearchRequest']['RetrievalCriteria'] end end end rc end |
#search_criteria ⇒ Object
Search criteria used in the search Returns a hash.
Example
{
"Queries"=>[{"BooleanOperator"=>"AND", "Term"=>"earthquakes"}],
"SearchMode"=>"all",
"IncludeFacets"=>"y",
"Expanders"=>["fulltext", "thesaurus", "relatedsubjects"],
"Sort"=>"relevance",
"RelatedContent"=>["rs"],
"AutoSuggest"=>"n",
"AutoCorrect"=>"n"
}
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/ebsco/eds/results.rb', line 347 def search_criteria if @results['SearchRequestGet'] && @results['SearchRequestGet']['QueryString'] params = CGI::parse(@results['SearchRequestGet']['QueryString']) sc = {} sc['SearchMode'] = params['searchmode'].nil? ? 'all' : params['searchmode'][0].to_s sc['IncludeFacets'] = params['includefacets'].nil? ? 'y' : params['includefacets'][0].to_s sc['Sort'] = params['sort'].nil? ? 'relevance' : params['sort'][0].to_s sc['AutoSuggest'] = params['autosuggest'].nil? ? 'n' : params['autosuggest'][0].to_s sc['AutoCorrect'] = params['autocorrect'].nil? ? 'n' : params['autocorrect'][0].to_s sc['Expanders'] = params['expander'].nil? ? [] : params['expander'][0].to_s.split(',') sc['RelatedContent'] = params['relatedcontent'].nil? ? [] : params['relatedcontent'][0].to_s.split(',') query1 = params['query-1'][0].to_s.split(',') sc['Queries'] = [{'BooleanOperator'=>query1[0], 'Term'=>query1[1]}] sc else @results['SearchRequest']['SearchCriteria'] end end |
#search_criteria_with_actions ⇒ Object
Search criteria actions applied. Returns a hash.
Example
{
"QueriesWithAction"=>[{"Query"=>{"BooleanOperator"=>"AND", "Term"=>"earthquakes"}, "RemoveAction"=>"removequery(1)"}],
"ExpandersWithAction"=>[{"Id"=>"fulltext", "RemoveAction"=>"removeexpander(fulltext)"}]
}
373 374 375 |
# File 'lib/ebsco/eds/results.rb', line 373 def search_criteria_with_actions @results['SearchRequest']['SearchCriteriaWithActions'] end |
#search_queries ⇒ Object
Queries used to produce the results. Returns an array of query hashes.
Example
[{"BooleanOperator"=>"AND", "Term"=>"volcano"}]
406 407 408 |
# File 'lib/ebsco/eds/results.rb', line 406 def search_queries search_criteria['Queries'] end |
#search_terms ⇒ Object
Returns a simple list of the search terms used. Boolean operators are not indicated.
Example
["earthquakes", "california"]
627 628 629 630 631 632 633 634 635 636 637 638 |
# File 'lib/ebsco/eds/results.rb', line 627 def search_terms terms = [] queries = @results.fetch('SearchRequest',{}).fetch('SearchCriteriaWithActions',{}).fetch('QueriesWithAction',{}) unless queries.nil? queries.each do |query| query['Query']['Term'].split.each do |word| terms.push(word) end end end terms end |
#solr_facets(facet_provided_id = 'all') ⇒ Object
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 |
# File 'lib/ebsco/eds/results.rb', line 557 def solr_facets (facet_provided_id = 'all') facet_values = [] available_facets = @results.fetch('SearchResult',{}).fetch('AvailableFacets',{}) if facet_provided_id == 'SourceType' && !temp_format_facet_results.nil? available_facets = temp_format_facet_results.results.fetch('SearchResult',{}).fetch('AvailableFacets',{}) end if facet_provided_id == 'ContentProvider' && !temp_content_provider_facet_results.nil? available_facets = temp_content_provider_facet_results.results.fetch('SearchResult',{}).fetch('AvailableFacets',{}) end available_facets.each do |available_facet| if available_facet['Id'] == facet_provided_id || facet_provided_id == 'all' available_facet['AvailableFacetValues'].each do |available_facet_value| facet_value = available_facet_value['Value'] if @titleize_facets_on and @titleize_facets.include?(facet_provided_id) title = EBSCO::EDS::Titleize.new facet_value = title.titleize(facet_value) end facet_count = available_facet_value['Count'] facet_values.push(facet_value, facet_count) end end end facet_values end |
#solr_pub_date_facets ⇒ Object
Publication date facets:
-
This year
-
Last 3 years
-
Last 10 years
-
Last 50 years
-
More than 50 years ago
285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/ebsco/eds/results.rb', line 285 def solr_pub_date_facets pub_date_facets = [] if stat_total_hits.to_i > 0 pub_date_facets.push('This year').push('') pub_date_facets.push('Last 3 years').push('') pub_date_facets.push('Last 10 years').push('') pub_date_facets.push('Last 50 years').push('') pub_date_facets.push('More than 50 years ago').push('') end pub_date_facets end |
#solr_search_limiters ⇒ Object
Translate limiters found in calls to Info endpoint into solr facet fields if they are turned on
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/ebsco/eds/results.rb', line 298 def solr_search_limiters search_limiters = [] if stat_total_hits.to_i > 0 if @limiters.any? _ft_limiter = @limiters.find{|item| item['Id'] == 'FT'} unless _ft_limiter.nil? search_limiters.push(_ft_limiter['Label']).push('') end _rv_limiter = @limiters.find{|item| item['Id'] == 'RV'} unless _rv_limiter.nil? search_limiters.push(_rv_limiter['Label']).push('') end _ft1_limiter = @limiters.find{|item| item['Id'] == 'FT1'} unless _ft1_limiter.nil? search_limiters.push(_ft1_limiter['Label']).push('') end _fr_limiter = @limiters.find{|item| item['Id'] == 'FR'} unless _fr_limiter.nil? search_limiters.push(_fr_limiter['Label']).push('') end end end search_limiters end |
#solr_spellcheck ⇒ Object
Example:
“spellcheck”:
"suggestions":[
"blesing",{
"numFound":1,
"startOffset":0,
"endOffset":7,
"origFreq":0,
"suggestion":[{
"word":"blessings",
"freq":1]}],
"correctlySpelled":false}}
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/ebsco/eds/results.rb', line 235 def solr_spellcheck suggestions = [] unless did_you_mean.nil? suggestions = [ search_terms.first.to_s, { 'numFound' => 1, 'startOffset' => 0, 'endOffset' => 7, 'origFreq' => 0, 'suggestion' => [{ 'word' => did_you_mean.to_s, 'freq' => 1 }] } ] end corrections = [] unless auto_corrections.nil? corrections = [ search_terms.first.to_s, { 'numFound' => 1, 'startOffset' => 0, 'endOffset' => 7, 'origFreq' => 0, 'correction' => [{ 'word' => auto_corrections.to_s, 'freq' => 1 }] } ] end unless did_you_mean.nil? && auto_corrections.nil? { 'spellcheck' => { 'suggestions' => suggestions, 'corrections' => corrections, 'correctlySpelled' => false } } end end |
#stat_total_time ⇒ Object
Time it took to complete the search in milliseconds.
330 331 332 |
# File 'lib/ebsco/eds/results.rb', line 330 def stat_total_time @results['SearchResult']['Statistics']['TotalSearchTime'] end |
#to_solr ⇒ Object
returns solr search response format
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/ebsco/eds/results.rb', line 119 def to_solr solr_start = 0 hl_hash = {} solr_docs = [] research_starters = [] publication_matches = [] if @records.any? @records.each { |record| # todo: add solr hl.tag.pre and hl.tag.post to retrieval criteria if retrieval_criteria && retrieval_criteria.fetch('Highlight',{}) == 'y' hl_title = record.eds_title.gsub('<highlight>', '<em>').gsub('</highlight>', '</em>') hl_hash.update({ record.eds_database_id + '__' + record.eds_accession_number => { 'title_display' => [hl_title]} }) #hl_hash.merge title_hl end solr_docs.push(record.to_attr_hash) } solr_start = solr_docs[0]['eds_result_id']-1 end if @research_starters.any? @research_starters.each { |record| research_starters.push(record.to_attr_hash) } end if publication_match.any? publication_match.each { |record| publication_matches.push(record.to_attr_hash) } end status = 0 wt = 'ruby' qtime = stat_total_time qterms = search_terms.join(' ') rows = results_per_page num_found = stat_total_hits.to_i eds_search_limiters_facet = solr_search_limiters eds_publication_type_facet = solr_facets('SourceType') eds_language_facet = solr_facets('Language') eds_subject_topic_facet = solr_facets('SubjectEDS') eds_publisher_facet = solr_facets('Publisher') eds_journal_facet = solr_facets('Journal') eds_subjects_geographic_facet = solr_facets('SubjectGeographic') eds_category_facet = solr_facets('Category') eds_content_provider_facet = solr_facets('ContentProvider') eds_library_location_facet = solr_facets('LocationLibrary') eds_library_collection_facet = solr_facets('CollectionLibrary') = solr_facets('AuthorUniversity') eds_publication_year_range_facet = solr_pub_date_facets eds_publication_year_facet = solr_facets('PublicationYear') eds_pub_year_tisim = solr_facets('PublicationYear') facet = true # solr response solr_response = { 'responseHeader' => { 'status' => status, 'QTime' => qtime, 'params' => { 'q' => qterms, 'wt' => wt, 'start' => solr_start, 'rows' => rows, 'facet' => facet } }, 'response' => { 'numFound' => num_found, 'start' => solr_start, 'docs' => solr_docs }, 'date_range' => date_range, 'research_starters' => research_starters, 'publication_matches' => publication_matches, 'highlighting' => hl_hash, 'facet_counts' => { 'facet_fields' => { 'eds_search_limiters_facet' => eds_search_limiters_facet, 'eds_publication_type_facet' => eds_publication_type_facet, 'eds_language_facet' => eds_language_facet, 'eds_subject_topic_facet' => eds_subject_topic_facet, 'eds_publication_year_facet' => eds_publication_year_facet, 'eds_publication_year_range_facet' => eds_publication_year_range_facet, 'eds_publisher_facet' => eds_publisher_facet, 'eds_journal_facet' => eds_journal_facet, 'eds_subjects_geographic_facet' => eds_subjects_geographic_facet, 'eds_category_facet' => eds_category_facet, 'eds_content_provider_facet' => eds_content_provider_facet, 'eds_library_location_facet' => eds_library_location_facet, 'eds_library_collection_facet' => eds_library_collection_facet, 'eds_author_university_facet' => , 'pub_year_tisim' => eds_pub_year_tisim } } } solr_response.update(solr_spellcheck) if solr_spellcheck solr_response end |