Visualizing Solr Search Results with D3

Slides:



Advertisements
Similar presentations
Solr Facets in Alfresco 4
Advertisements

CSS3 OVERVIEW Owen Williams Owen at dynabooks daht com.
Understanding netTrekker, for Parents A CYC Electives Module
1 How To Use a Browser A Module of the CYC Course – Computer Basics
The Internet Public Library Using the Internet Public Library: Jennifer Lau-Bond User Services.
Photo by shindoverse - Creative Commons Attribution-NonCommercial-ShareAlike License with Haiku Deck.
Slice and Dice: From PSD Image to XHTML+CSS Svetlin Nakov Telerik Corporation
This work is licensed by Patrick Crispen to the public under the Creative Commons Attribution- NonCommercial- ShareAlike 2.5 license.
August 2012 This work is licensed under the Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai development tips Aaron Zeckoski
1 Programming the Web: HTML Basics Computing Capilano College.
Mike Sanders, Alison Stokes, Pauline Kneale and Yolande Knight GEES Subject Centre Open Educational Resources (OER) in fieldwork: practicalities, pedagogy,
CREATING WEB PAGES INTERNET IN THE CURRICULUM MODULE 8:
Creative Commons licensing for game content creators Jessica Coates Project Manager Creative Commons Clinic AUSTRALIA part of the Creative Commons international.
Derek France, Mike Sanders, Alison Stokes and Katharine Welsh GEES Subject Centre Fieldwork and technology NTF and the Open Fieldwork Project 30 June 2011.
ENGAGING FACULTY AROUND NEW MODELS Sarah Shreeves & Joy Kirchner ACRL Workshop: Scholarly Communication 101.
PARCC in Illinois Presented by: Dan Frederking Principal Consultant Illinois State Board of Education Illinois State.
Making maps with Leaflet.js Steve Signell, Instructor Robert Poirier, TA School of Science Rensselaer Polytechnic Institute.
Building a Foundation Open Access and Open Educational Resources in Allied Health Higher Education for Lifelong Research.
An Introduction to D3.js By Robert Dillon.
D3: The Crash Course. D3: Scratching the Surface.
D3 Resources.
Quick & Easy Data Visualization with Google Visualization API + Google Chart Libraries Bohyun Kim ( Twitter: Associate Director for.
Source: ojects/tabber/ ojects/tabber/
Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site.
CSCI 3100 Tutorial 6 Web Development Tools 1 Cuiyun GAO 1.
2.744 Dreamweaver Tutorial Sangmok Han Feb 24, 2010.
Programming Club IIT Kanpur. Work environment Before you begin coding,always set up your work environment to your needs IDE Notepad++ Sublime Text 2.
2 History of World-Wide Web and HTML  1989: WWW has been invented at CERN  1991: Official birthday of HTML.
Very quick intro HTML and CSS. Sample html A Web Title.
Cascading Style Sheets (CSS): Pixel-Level Control with HTML Ease
Photo by ais3n - Creative Commons Attribution-NonCommercial License with Haiku Deck.
Stylesheets and Coding Web. Cascading Style Sheets (CSS) Also referred to as “style sheets.” CSS separates the presentation of an HTML document from the.
Introduction to Metadata: Describing datasets CQU Librarians workshop, 11 February 2015 Kathryn Unsworth - Data Librarian This work is licensed under a.
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
Diliev.com & pLOVEdiv.com  DIliev.com.
 1. You must have a personal page to create a Club page. You will use this account to manage your Club account. Your personal account profile is separate.
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
6. Timelines. Explore the development of the English language over time…
TUTORIAL 8: Enhancing a Web Site with Advanced CSS
Web Design Transparent Backgrounds. Why : Allow text to appear clearly above a graphic background image that still can be seen in the background. Without.
Additional Topics. Tutorial #9 Review – Forms Forms Legend and fieldset Fields Text Password Radio buttons, check box, text area, select lists Buttons.
Web Technologies Website Development Trade & Industrial Education
Web Designing By Bhupendra Ratha, Lecturer School of Library & Information Science D.A.V.V., Indore.
CSS My favourite ICT lesson By Federico Boschi Cascading Style Sheets.
Copyright 2006 South-Western/Thomson Learning Chapter 17 Creating and Linking Web Pages.
Support.ebsco.com EBSCOhost Visual Search Tutorial.
JavaScript – The DOM JavaScript is object based The browser is object based – We can access the browser's objects in the same way we did JavaScript's Two.
 Remember that HTML is just text  Need to point to pictures  Use the img tag  alt: › screen reader › REQUIRED for this class and to validate.
Language Club KompoZer Design View. Files you will need  Images  pages  Templates  Text.
Lecture 2 - HTML and CSS Review SFDV3011 – Advanced Web Development 1.
Photo Sharing. A popular photo sharing site Founded 2004 by 2 Canadians Stewart Butterfield Caterina Fake Bought by Yahoo in million users Well.
ResultMaps: Search Result Visualization for Hierarchical Information Spaces Danielle H. Lee.
HTML Elements: Forms and Controls Chapter 9 B. Ramamurthy.
FMI-PLOVDIV Web Dynamic Applications
CCT260H - Christopher Evan Jones
Shiny App with d3 data visualization
Build a WordPress Site A Real Life Example: Create a Fully Functional WP Business Web Site from Scratch Building a WP Site SoftUni Team Technical Trainers.
Front-End Framework for Responsive Web Sites
A project for teaching new contributors
CSS Transitions and Animations
Revision.
Introduction to Programming the WWW I
Lesson Objectives Aims You should know about: – Web Technologies
Photo by cod_gabriel - Creative Commons Attribution License Created with Haiku Deck.
For use on your feedback page
Understand basic HTML and CSS terminology, concepts, and basic operations. Objective 3.01.
Photo by fortinbras - Creative Commons Attribution-NonCommercial-ShareAlike License Created with Haiku Deck.
Photo by Sean Barnard - Creative Commons Attribution-NonCommercial License Created with Haiku Deck.
Cascading Style Sheets
Presentation transcript:

Visualizing Solr Search Results with D3 Visualizing Solr Search Results with D3.js for User-Friendly Navigation of Large Results Sets Julia Bauder, Grinnell College Libraries Code4Lib 2014, Raleigh, NC March 26, 2014

Graphs, not lists! Or, to give the presentation a shorter, pithier title: Graphs, not lists! Later in this presentation I’m going to show you how you can give your users search results as graphs, but first I want to talk about why I think you should give your users the option of viewing their search results as graphs instead of just as lists. And, if you’ll indulge me, I’m going to explain why by telling you a story. Close your eyes, if that’s helpful to you, and picture an undergraduate.

Let’s say she’s a sophomore Let’s say she’s a sophomore. She’s currently taking her second sociology class, so she doesn’t really know a whole lot about the field of sociology yet, but she was just assigned to write her first real research paper in sociology. She’s not really sure what she wants to write about, exactly, but she’s thinking about something related to images of women in popular culture, maybe? So she goes to your catalog and she types in “women in popular culture,” just to see what’s out there on the topic, and she hits search. Have you got your mental picture of this undergraduate? Go ahead and open your eyes if you do, and think about what’s going to happen next. Unless you have a very small library, she’s going to get hundreds or thousands of results for that search, right? We only have about a million records in our catalog, and that search gets over 700 hits. If you try it in something like the University of California’s WorldCat Local discovery layer, you get well over 20,000 hits. Now, put yourself back in that students’ mind, with a list of hundreds or thousands of hits in front of her, a lot of which don’t look very relevant to what she thinks she wants to write about.  You know she’s not going to read through 700 results, let alone 20,000, and as much as we tweak our relevance rankings, a relevance ranking is only as good as a user’s ability to translate their felt information need into an actual search string -- which, since she’s a sophomore just starting to explore topics in an area she isn’t very familiar with, clearly isn’t very good yet. But that’s normal! Image by Jessica Quinn. Used under a Creative Commons Attribution-NonCommercial license. http://www.flickr.com/photos/jlee43/244136188/sizes/o/

Initiation → Selection → Exploration → Formulation → Collection → Presentation Kuhlthau, C. C. (2004). Seeking meaning: A process approach to library and information services. Westport, CT: Libraries Unlimited. If you’ve been to library school in the past 15 years or so, you probably encountered Kuhlthau’s model of the information search process while you were there. If you have, you know that this stage of the research process -- she calls it “exploration” -- is generally the most stressful and confusing for students. This process of starting with a sort of fuzzy, general idea of what they want to write about, and doing some searching and getting a sense of what’s out there and refining their topic and eventually, we hope, honing in on something manageable -- students tend to find this part of the process frustrating, confusing, and anxiety-provoking. And search tools that give them a list of thousands of results when they’re at this stage of the process don’t help. Using the catalog to test out a potential topic that they find interesting and getting an overwhelmingly humongous list of not-quite-relevant things says, “Bzzt! You’ve failed at searching. Try again.” But they haven’t failed, not really. They’re trying to get a sense of what’s out there on their topic, to situate themselves in the scholarly landscape around that issue and figure out which piece of land they want to stake out as their own. And that list of thousands of items contains the data to help them do that really well. The problem is that, when that data is formatted as a giant list, it’s way too much information for them to process. This is where graphs come in. Presenting information as graphs, rather than lists, makes it possible to take in lots of information at once, to get an overall sense of the landscape at a glance. And it’s actually not that hard to present catalog results as a graph, using features built in to Solr that provide hierarchical faceting data and using the D3 Javascript library, which is designed for creating data visualizations.

&facet=true&facet.pivot=callnumber-first,callnumber-subject http://localhost:8080/solr/biblio/select?q=allfields%3AJane+Austen&wt=json &facet=true&facet.pivot=callnumber-first,callnumber-subject "facet_pivot":{ "callnumber-first,callnumber-subject":[{ "field":"callnumber-first", "value":"P - Language and Literature", "count":311, "pivot":[{ "field":"callnumber-subject", "value":"PR - English Literature", "count":270}, { "value":"PN - General Literature", "count":29}, I’m starting out with the assumption that you have at least some of your library data in Solr already, given how many of the institutions represented here use one or more of Blacklight, VuFind, Hydra, or Islandora, all of which use Solr for searching. And as I’m sure you already know, Solr will give you facet counts for search results. But more recent versions of Solr, 4.0 or above, will also give you what are called pivot facets, or decision tree facets. These pivot facets are multi-level. Like you can see on the screen, this snippet of a response for a Solr query with pivot facets gives you, in this case, facets for more specific call number groups within broader call number groups. So now you’ve got hierarchical facet data. You can do this with any index fields you want, and they don’t have to be ones that are strictly hierarchical like one-letter and two-letter call number stems are. You’ll see some examples later in the presentation of ones that aren’t strictly hierarchical. [pause for a second for people to take this json in]

Field Trip! https://github.com/mbostock/d3/wiki/Gallery And D3, the Javascript library for data visualization, has some excellent visualizations for hierarchical data -- and non-hierarchical data, for that matter. I was trying to put some images on this slide to give you an example of what D3 can do, but there are so many visualizations, it’s easier to take a quick field trip to one of the many D3 galleries on the Web to take a quick look at some examples. D3 makes it really easy to create visualizations like these, but there are a couple of catches. One catch is that some of the visualizations are really sensitive to dirty data and missing data. This seems to be a particular problem with treemaps, the third visualization in the fourth row there, which is a visualization I really like and wound up using in our production system because it’s an extremely space-efficient visualization. If, say, you're trying to do a call number based treemap, and some homegrown non-LC-like call numbers snuck into your call number index, and they’re different enough in format from real LC call numbers that SolrMarc’s call number maps don’t handle them cleanly, D3 is likely to just refuse to draw a treemap if your results include an item with one of those call numbers. (I won't tell you how long it took me to figure out that that was why the treemap just wouldn't render some of the time.) Another catch is that D3 expects to get this hierarchical data in a very particular format, which is not the format in which Solr outputs the pivot facet data. But I have a little piece of code on Github that will take Solr’s pivot facet output and transform it into the “flare” json format that D3 expects. I have a link to that code on my last slide. With that code, all you have to do to start playing around with creating D3 visualizations of your own Solr data is to pick the index fields that you want to visualize, go to a D3 example site like this one, and find some example code for a D3 visualization that you want to try. The code that I have on Github is a pure Javascript thing, not for production since it needs direct access to Solr, but you can really easily play around with different types of D3 visualizations and visualizing different fields in your Solr index with this, just to get a sense of what’s possible and what might be useful. https://github.com/mbostock/d3/wiki/Gallery

"name":"P - Language and Literature", "size":281, "children":[ var theData = { "name":"theData", "children":[{ "name":"P - Language and Literature", "size":281, "children":[ {"name":"History and criticism", "size":86}, {"name":"Criticism and interpretation","size":58}, {"name":"History", "size":55}, {"name":"Women and literature", "size":45}]}, etc., etc. And it really is super easy. I can fit the code to create a basic treemap on three slides. So on this slide, we have some of our data, in the “flare” JSON format that D3 expects when you’re creating hierarchical visualizations. In this case we’re doing call numbers and topic facets, which are subsections of Library of Congress Subject Headings. A lot of the time you’ll pull this data in via a JSON API, which D3 has excellent support for.

var treemapdiv = d3.select("body") .append(“div”) Based on the zoomable treemap example code from http://bl.ocks.org/mbostock/4063582 var treemapdiv = d3.select("body") .append(“div”) .style("width", "710px") .style("height", "575px"); var treemap = d3.layout.treemap() .size([710, 575]) .value(function(d) { return d.size; }); var color = d3.scale.category20(); The code on this slide and the next slide is a simplified version of the zoomable treemap code at this link. This is an example created by Mike Bostock, the guy behind the D3 library. So on this slide we create a div in which to put the treemap, and we initialize the treemap and give it a size. Make note of that function(d) part there -- I’m going to talk about that more on the next slide, but it’s where the magic happens. We’re also declaring our color scheme here. D3 comes bundled with color scales, so you don’t have to declare specific colors for the different pieces of the visualization (although you can if you want to) -- you can just tell it to use one of the built-in color scales, like we’re doing here, and it will automatically assign a different color to each piece.

var node = treemapdiv.datum(theData).selectAll(".node") .data(treemap.nodes) .enter().append("div") .call(position) .style("background", function(d) { return d.children ? color(d.name) : null; }) .text(function(d) {return d.name + " (" + d.size + " )"; }); function position() { this.style("left", function(d) { return d.x + "px"; }) .style("top", function(d) { return d.y + "px"; }) .style("width", function(d) { return d.dx + "px"; }) .style("height", function(d) {return d.dy + "px";}); } And then, this actually draws our treemap. The first three lines on this slide bind our data to HTML elements on the page. We’re creating a div, with the class “node,” for each of our pieces of data. And then each of those divs has the data bound to it -- both the data in our original dataset, the name and the size for each node, but also data that D3 calculated for us. Since we told D3 we wanted a treemap, in this case it calculated the x position, the y position, and the width and the height for each node, which gives you everything you need to draw the basic treemap. If you do a different type of visualization, obviously it will calculate different things. But everything that it calculates for each node, and everything that was included in your original data, you can access using function(d). So we access that data for each node and we use it to assign a position and a size to the div that goes with each node, as you can see in the “position” function -- the x and the y coordinates for the upper-left corner of each node are in the variables x and y, and the width and the height are in the variables dx and dy. And then to finish up our treemap, we assign each div a color, and we create a text label for each one with the name and the number of items. If that doesn’t make sense -- and it takes most people a while to wrap their head around what D3 is doing when you’re binding data to elements that don’t exist yet -- there’s a marvelous article by Mike Bostock called “Thinking with Joins” that makes this make more sense. You can just Google “Thinking with Joins” and Mike Bostock to find it. And that’s all you have to do to draw a basic treemap. You’ll probably want to do more a lot of the time -- you’ll want to make it do something when you click on a node, for example -- but it’s just as easy to add additional functions on top of this basic treemap. So, ready to see what it looks like when you put it all together? I’ve written a VuFind add-on that uses Solr pivot facet data and D3 treemaps to give students the option of viewing their results as a graph or a list. We just pushed this out to our production server on this past Friday; our students are on spring break this week, so the official launch will be when they get back on Monday.

Demo time! So, let’s think back to our hypothetical student and her search for women in popular culture. So if you go to our library catalog and do a keyword search for women in popular culture, it will still default to a list of results, but you will have a link to click over and see the graph of the results. [pause for a second for people to take this in] So, what can you tell by looking at this? You can tell that in addition to sociology, the field of language and literature also has an major interest in this topic. There’s even more in language and literature than in social sciences for it, in fact. You might notice that the specific topic “women in popular culture” shows up in both the language and literature section and the social sciences section, and you might click on those boxes to see the specific books in each area and to get a sense of how social scientists and literature folks approach this topic differently. You can see that if you’re interested in women in literature or women in film, that the material on that is in language and literature rather than in the social sciences. This might be a clue to our hypothetical student – maybe looking at portrayals of women in literature or in film is a more appropriate topic for a literature class than a sociology class? You can see that there are a substantial number of books in U.S. history about women in popular culture, and if you click on that you can zoom in and see the topics covered by those books. You can see that there are just a few books on African American women, specifically, in popular culture, and again, you can click on one of these boxes to see the specific books. For right now, this visualization -- a treemap with the first letter of the call number as the top level and the topic facets, which are sub-sections of Library of Congress Subject Headings, for the second level -- is the only available visualization. For the first phase of this project I hard-coded the fields that are visualized in a couple of places. It was just easier to have a smaller number of moving pieces as I was developing and testing this. But I am definitely planning on going back and making that a configurable option, so that you can choose to visualize based on different fields. I might consider making it an option to choose different visualizations at some point, too, but again, that wasn’t something I wanted to tackle in the first round of development.

Image by Mike Hiatt. Used under a Creative Commons What are the next steps? I’ve been talking with Demian Katz, who is in charge of the VuFind project, about getting this into the core VuFind code, and I’m working on that and hope to have that done within the next few weeks or months. And then, obviously, as a new type of interface this is just crying out for usability testing. And we have an intern lined up for the summer who is interested in human-computer interaction and who is going to be doing usability testing on a bunch of our systems, including this one. So I’m hoping to publish the results of that testing sometime next year. Because so far, the only students who have seen this are ones who work for the library. We staff our reference desk with well-trained undergraduates who we call “research tutors,” and they were some of the first people I showed this to. And when I asked them how they thought they might use it, their initial reaction was a lot like the initial reaction of the reference and instruction librarians when I showed it to them: they viewed it as a teaching tool, as something they could use to help explain concepts like disciplinarity and interdisciplinarity to students, or to help explain how the Library of Congress Classification works. So I’m really curious to see how naïve students, ones who don’t have a librarian or a research tutor sitting next to them explaining what the visualization represents, react to it and interact with it. I think even if we do wind up only using this as a teaching tool, it will still be worth it, but like I said, I’m really excited to see what students end up doing when we let them see the results of their searches as graphs, not lists. Image by Mike Hiatt. Used under a Creative Commons Attribution-NonCommercial-ShareAlike license. http://www.flickr.com/photos/mfhiatt/5118798852/

Thank you! Solr pivot facet JSON to D3 JSON converter: https://github.com/GrinnellCollegeLibraries/Pivot_to_Flare General D3 Resources: http://d3js.org/ (The official D3 site.) https://www.dashingd3js.com/ (Tutorial for getting started with D3.) Sources for D3 sample code: https://github.com/mbostock/d3/wiki/Gallery http://bl.ocks.org/mbostock Reference for hierarchical visualization layouts in D3: https://github.com/mbostock/d3/wiki/Hierarchy-Layout Thank you. Any questions? Thank you! Contact me: Julia Bauder, Grinnell College Libraries bauderj@grinnell.edu