Skip to content

Instantly share code, notes, and snippets.

@mreidsma mreidsma/about.markdown
Last active Aug 29, 2015

Embed
What would you like to do?
Clean up Sierra non-Keyword search results pages

Clean up No Results pages on non-keyword searches in Sierra

The default no results pages in Sierra's OPAC often confuse our patrons, and we've struggled with how to make these screens more intuitive to users. The original screen shows nearby results (for title, author, journal title, etc. searches) and places a box where the patron's search would be if we had it. In some cases, help prompts for switching to a keyword search, searching MelCat (the state-wide consortium), or inverting author names to the last first order are also included. But our patrons never seem to see this box, and often don't realize that they haven't gotten any results. (Sierra defaults the No Results message to red, which made them think they'd made a mistake. We changed it to black but now it's invisible.)

Default keyword search result screen

The default non-keyword results screen in Sierra

After some colleagues suggested we take a stab at improving this page, I did some research into search results best practices. In their book Designing the Search Experience, Tony Russell-Rose and Tyler Tate give a few best practices for designing no results screens (p. 162):

  • Provide an explicit message when zero results are returned
  • Provide support in the form of advice and tools for query reformulation
  • Display other navigation options such as top searches, featured products, popular items, and so on

The default Sierra screen actually has all of these features, but they aren't getting noticed by the user. I had watched our patrons overlook the box with both all of the contextual help and the place that told them no results were found. I decided to use JavaScript to rewrite this page (since JavaScript is required for Sierra's OPAC to work, anyway) and consolidate all of the information the patron might need in one place. (All except for the third point, which in this case is the contextual list of 'nearby' items).

Revised keyword search result screen

The revised non-keyword results screen in Sierra

The following script will rewrite, on the fly, any non-keyword search page in Sierra's OPAC to use the more obvious and useful no results layout. You need to run this script after including jQuery.

Email me at reidsmam@gvsu.edu or @mreidsma on Twitter if you have any questions.

// Requires jQuery
if($('.yourEntryWouldBeHere').length > 0) {
var invertSearchTxt, invertSearchUrl, newMelSearch, pageText, pageType, invertSearchPrefix, searchTips;
// Make a nice no results message
// First, get the links for MeL and for changing the search
searchTerm = $('tr.yourEntryWouldBeHere td').find('font').text();
pageText = $('tr.msg').find('td').text();
// Don't run this on Nearby on Shelf results pages
if(pageText.trim() !== "Nearby LC Call numbers are:") {
pageText = pageText.toLowerCase();
pageType = pageText.split("; ");
invertSearchText = $('tr.yourEntryWouldBeHere td').find('a:first').text();
invertSearchUrl = $('tr.yourEntryWouldBeHere td').find('a:first').attr('href');
newMelSearch = $('tr.yourEntryWouldBeHere td').find('a:last').attr('href');
if(newMelSearch === undefined) {
// Probably Journal Title Search
searchTips = '';
} else {
// Title, subject, or author search
if(invertSearchText != 'Search as Words') {
// This is an author search
invertSearchPrefix = 'Change search to ';
} else {
// This is probably a title or subject search
invertSearchPrefix = '';
invertSearchText = 'Search ' + searchTerm + ' as keywords';
}
// Set extra search terms
searchTips = '<ul class="bullet-list"><li>' + invertSearchPrefix + '<a href="' + invertSearchUrl + '">' + invertSearchText + '</a></li><li><a href="' + newMelSearch + '">Search other libraries for ' + searchTerm + '</a></li><li>Revise your search and try again</li></ul>';
}
// Write the new HTML
$('.msg').html('<div class="noResults lib-note" style="padding:1.25em 0;"><h4 style="font-weight:bold;text-align:center;">No matches Found.</h4><div style="width:50%;margin:0 auto;font-size:80%;">' + searchTips + '</div></div><p style="margin-bottom:0 !important;font-weight:bold;font-size:80%;text-transform:capitalize;">' + pageType[1] + '</p><style>.noResults ul li { padding-bottom:.4em;}</style>');
// Hide the old weird links
$('tr.yourEntryWouldBeHere td').find('a').css('display', 'none');
$('tr.yourEntryWouldBeHere td').css('color', '#88B3DA').attr('align','left').css('background-color', '#88B3DA').css('border-color', '#6694cc')
$('tr.yourEntryWouldBeHere td').find('b').css('display','inline-block').css('color', '#333').css('padding','1em 0 1em 2.4em');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.