-
Notifications
You must be signed in to change notification settings - Fork 10
Solr and Blacklight Support
Bill McKinney (EBSCO) edited this page Oct 17, 2019
·
16 revisions
An effort has been made to provide methods in this gem to accept basic solr queries and to supply solr responses. This has been done so that the BlackLight EDS repository class can remain light weight and take advantage of many out-of-the box BlackLight defaults based on Solr.
Example:
results = session.search({'q' => 'volcano', 'start' => 0, 'rows' => 10, 'search_field' => 'title'})
results.to_solr
=> {"responseHeader"=>{"status"=>0, "QTime"=>119, "params"=>{"q"=>"volcano", "wt"=>"ruby", "start"=>0, "rows"=>10, "facet"=>true}}, "response"=>{"numFound"=>6744, "start"=>0, "docs"=>[{"id"=>"cat02060a__d_uga_4083378", "title_display"=>"Volcano. [electronic resource] : [nature and culture].", "academic_journal"=>"Volcano [electronic resource] : [nature and culture].", "pub_date"=>"2012", ...
Solr support includes: facets, search fields, sorting, spelling suggestions and highlighting.
Solr queries are supported via the Options class.
For example, if the options passed to the Search class include Solr's per_page
parameter, it is treated just the same as if you had used the gem's results_per_page
parameter.
Examples:
session = EBSCO::EDS::Session.new({use_cache: false, profile: 'eds-api'})
query = {
'f' => {
'eds_journal_facet'=>['new york times'],
'eds_subjects_geographic_facet'=>['united states'],
'eds_content_provider_facet'=>['Academic Search Ultimate'],
'eds_publication_year_facet'=>['Last 3 years']
},
'per_page'=>'10',
'sort'=>'pub_date_sort desc',
'q'=>'lincoln',
'search_field'=>'all_fields',
'controller'=>'catalog',
'action'=>'index',
'hl'=>'off' }
results = session.search(query)