QuickSearch: now open source!

Kevin Beswick

NCSU Libraries

@kbeswick

Last week, we open sourced QuickSearch

https://www.github.com/NCSU-Libraries/quick_search

What is QuickSearch?

  • NCSU's single-search w/ bento-box style results
  • Originally launched in 2005
  • Re-written in 2014 using Ruby on Rails
  • Thanks to:
    • Cory Lown who wrote a lot of the code
    • Jason Ronallo who provided feedback and guidance

Features

  • Development environment with Vagrant/Ansible included
  • Modular & extensible
    • Searchers
    • Themes
  • Statistics (local & GA), Best Bets

Searchers

  • Plugin that provides search functionality for a particular library service
  • Published as Ruby Gem
  • Easy to write

How easy?

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') %>

That's it!

Maybe a few more things for production

  • Custom results template
  • Config
  • i18n

We've released a few searchers so far

  • arXiv
  • OpenLibrary
  • Wikipedia
  • Summon
  • Nutch (website search)

Themes

  • Also published as Ruby Gems
  • Override parts of default theme (header/footer)
  • Create entirely new theme
  • Generic theme available - based on Foundation CSS framework

Statistics

Disclaimer

  • Extracted from our production code - but still early stages

TODO

  • Improve docs
  • Fix unit/integration tests
  • Port over a few more features (example: typeahead)
  • Make QuickSearch core a Rails Engine

We want to work with you!


kdbeswic@ncsu.edu

@kbeswick


https://www.github.com/ncsu-libraries/quick_search

https://search.lib.ncsu.edu/