bento_search 1.0.0 released

I have tagged and released version 1.0.0 of my bento_search gem.

bento_search is a ruby gem for use in Rails, that provides an abstraction/normalization layer supporting searching and displaying results from external search engines — helping you implement such functionality in your own Rails app.  Focused on academic library use cases.

It’s designed not only to help developers get started more quickly implementing search function based on external services, using this shared code — but also to allow people (such as me!) to avoid vendor lock-in and minimize cost of switching from one external search provider to another. Say, from Summon to PrimoCentral.

Search engines supported include Summon, EDS, Primo, EBSCOHost ‘traditional’ API, Scopus, Google Books, and Google Site Search.

I don’t tag “1.0.0” until I am fairly confident it’s mature enough for use, and mature enough to stay backwards compatible for a while. In this case, I’ve had it in production at my institution for about a month now, used for an ‘article search’ based on EBSCOHost traditional API.  I’ll try post more about our own implementation soon (The meat of it is protected to only users affiliated with my institution, so you can’t see it live).

I am rather happy with bento_search, I think it’s some of the nicest, most well-designed code I’ve written. If you have a Rails app (or want a Rails app) into which you’d like to incorporate a search using an external search provide, I think/hope you’ll find it pleasant, even fun, to work with.

Visual of what sorts of things you can do with bento_search, both screenshots from the sample_megasearch demo provided for bento_search:



As examples of how easy it is to get a basic prototype like that running with bento_search, some code snippets from the sample_megasearch demo app:

Configure a search engine:

BentoSearch.register_engine("summon") do |conf|
  conf.engine     = "BentoSearch::SummonEngine"
  conf.access_id  = ENV["SUMMON_ACCESS_ID"]
  conf.secret_key = ENV["SUMMON_SECRET_KEY"]

  conf.lang       = "en"

  conf.fixed_params = {
    # These pre-limit the search to avoid certain content-types, you may or may
    # not want to do.
    "s.cmd" => ["addFacetValueFilters(ContentType,Web Resource:true,Reference:true,eBook:true,Book Chapter:true,Newspaper Article:true,Trade Publication Article:true,Journal:true,Transcript:true,Research Guide:true)"],
    #"s.fvf[]" => ["ContentType,Reference,true"],

    # because our entire demo app is behind auth, we can hard-code that
    # all users are authenticated.
    "s.role" => "authenticated"

  conf.for_display = {:decorator => "RefworksAndOpenUrlLinkDecorator"}


A controller action method for multi_search:

 def index
    if params[:q]
      searcher =*@@foreground_engines)
      searcher.start(params[:q], :per_page => @@per_page, :semantic_search_field => params[:field])

      @results = searcher.results
      @ajax_bg_engines = @@ajax_bg_engines
      @ajax_triggered_engines = @@ajax_triggered_engines

Excerpts from a view template for single search:

    <% if @results.total_items && @results.total_items > 0 %>

Showing  <%= number_with_delimiter @results.pagination.start_record %> through <%= number_with_delimiter @results.pagination.end_record %> of <%= number_with_delimiter @results.pagination.count_records %>  (fetched in <%= "%.3f" % @results.timing %>s)

    <% end %>

    <%= paginate @results.pagination %></pre>
<div class="row <%= @results.engine_id %>">

 <%= bento_search @results %></div>

But wait, there’s more!

  • Export as RIS
  • Convert to OpenURL
  • Full machine-readable serialization in Atom including all internal metadata
  • All user-facing text stubbed for i18n
  • Good automated testing coverage
  • Good documentation coverage
  • Fielded search, (kaminari-compatible) pagination, and sorting, all with a provide-agnostic API
  • Limited support for AJAX delayed loading of results
  • Support for query-in-context term highlighting, where provided by underlying provider.
  • Support for multi-threaded concurrent searching of multiple sources

It’s probably not perfect, I’m sure it will have some bugs I don’t know about it, that we’ll discover when it gets other users. I do expect some fine-tuning of the mapping of third-party API’s to internal bento_search model will be required for providers other than EBSCOHost, because they all tend to be under-documented and surprisingly behaved, and I’ve spent lots of time hunting down edge cases only in EBSCOHost so far (although they all work for basic demos).


1 thought on “bento_search 1.0.0 released”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s