quick_search-my_catalog_searcher/app/ searcher/quick_search/my_catalog_searcher.rb
module Quicksearch
class MyCatalogSearcher < Quicksearch::Searcher
def search
resp = @http.get("https://mycatalog.com/search?q=" + query)
@response = JSON.parse(resp.body)
end
def results
results_list = []
@response['docs'].first(@per_page).each do |value|
results_list << OpenStruct.new(
title => value['title'],
link => value['link'],
author => value['authors'],
date => value['date_published'],
thumbnail => value['cover_url']
)
end
results_list
end
end
quick_search/Gemfile
# ...
# QuickSearch searchers
gem 'quicksearch_wikipedia_searcher', git: 'git@github.com:ncsu-libraries/quick_search-wikipedia_searcher.git'
gem 'quicksearch_open_library_searcher', git: 'git@github.com:ncsu-libraries/quick_search-open_library_searcher.git'
gem 'quicksearch_arxiv_searcher', git: 'git@github.com:ncsu-libraries/quick_search-arxiv_searcher.git'
gem 'quicksearch_my_catalog_searcher', path: '../quick_search-my_catalog_searcher'
quick_search/config/quicksearch_config.yml
# ...
# Searchers that QuickSearch will use
searchers: [best_bets,arxiv,open_library,wikipedia,my_catalog]
my_theme/app/views/search/index.html.erb
<%= render_module(@my_catalog, 'my_catalog') %>
https://www.github.com/ncsu-libraries/quick_search
https://search.lib.ncsu.edu/