New BookLikes Tool: Advanced (Boolean) Shelf Searches

Introduction

A few weeks ago, I had great fun creating the Follower Comparison Tool which uses BookLikes’ API to help you compare your lists of followers and followings.  After taking a break, the wheels started spinning again as I wondered, “What could I do next?”  This post is my answer to that question.

 

Have you ever tried using BookLikes to search for books on a combination of your shelves?  If so, you were probably annoyed.  Whether you know the term or not, the reason you were annoyed was because BookLikes has very limited “Boolean search capabilities”.  Goodreads is slightly better, but not by much.

 

This new tool should let you run more advanced searches on your BookLikes shelves.  You can search on a combination of shelves using AND/OR/NOT logic.  It’s not perfect, but I do think it’s better than what we have now.  If you’re still not clear what I’m talking about, hopefully the details below will help.  Here’s the link to the tool: Boolean Shelf Search

 

Why Would You Want to Use This?

These are the things you currently can’t do on BookLikes, but that you should be able to do with this new tool:

 

1. On BookLikes, you can’t use “NOT” logic in your search. (You can’t do this on Goodreads either.) In other words, you can’t retrieve a list of books that are on one shelf but not another.  As an example, let’s say that elves are very important to you.  You actually have a shelf called “elves”, and you shelve any book there if it has an elf.  One day you decide you’re really sick of elves, and you want a list of books that are on your “fantasy” shelf but not on your “elves” shelf.  This would give you a list of elf-free fantasy books.

 

2. On BookLikes, you can’t use “OR” logic in your search. (You can’t do this on Goodreads either.) In other words, you can’t retrieve a list of books that are on either one shelf OR another.  For example, you might want a list of books that are on either your “fantasy” or “science fiction” shelves, which would be a complete list of your shelved SF&F books.

 

3. On BookLikes, you can do an “AND” search, but it’s very limited. (Goodreads handles this better.) To clarify, an “AND” search gives you a list of only the books that are found on all of the selected shelves.  If I search for books shelved as “fantasy” AND “standalone”, I would get back a list of only my standalone fantasy books.  When it comes to “AND” logic, BookLikes has the following limitations:

 

a) You can only select two shelves at a time. Even if you had shelves for “standalone”, “fantasy”, and “elves”, you couldn’t get a list of your standalone fantasy books that contain elves. This is a travesty! :)

 

b) The two shelves you select must consist of one exclusive shelf and one non-exclusive shelf. So you actually couldn’t even get a list of your standalone fantasy books, because “standalone” and “fantasy” are both non-exclusive shelves.

 

c) BookLikes doesn’t handle custom exclusive shelves correctly. It treats them like normal, non-exclusive shelves. For example, if you created an exclusive “Did-Not-Finish” shelf, the limitation from 3b means that you could only search your “Did-Not-Finish” shelf in combination with the default exclusive shelves (read, planning to read, or currently reading).  This would be pointless, since it’s impossible (and undesirable) for two exclusive shelves to have the same book.

 

How Does this Thing Work?

I included some brief instructions on the web application, and I tried to make it intuitive, but I’m just not sure if the results of my thought process will make sense to other people.  I don’t know if people will look at the tool and say, “This is so obvious; why did you write a book about it?” or if they’ll look at it and say, “This makes no sense, what the heck is this?”

 

The Short Explanation

Here’s a short explanation for people already familiar with Boolean logic.  You’ll be given two grids, each of which lists all your shelves with checkboxes you can use to select them.  Each shelf you select within a single grid will be treated as an “AND” comparison.  You can add a “NOT” qualifier to any of the shelves by toggling the +/- button to exclude.  If you use both grids, the results from each grid will be combined using an “OR” comparison.

 

If that paragraph made sense, you can stop reading because you’ve got this. :)  If it sounded like gibberish, hopefully the following paragraphs and pictures will be much clearer! 

 

The Loooooong Explanation

Entering your User ID works the same way as it does for the Follower Comparison Tool, and everybody seemed to do fine with that so I won’t go into any detail on it.  The step-by-step instructions are on the tool if you need them.

 

After you enter your User ID, you’ll be presented with two grids, each of which lists all your shelves.

 

 

You can make selections in just one of the grids (it doesn’t matter which one), or you can use both of the grids.  For now, let’s just focus on what happens within a single grid:

* Use the “Select?” checkboxes to select the shelves you want included in the search.

* Click the “Include/Exclude” buttons to toggle a shelf between include or exclude. 

* Shelves without a checkmark will be ignored altogether, regardless of whether the button is set to include or exclude. 

* If you click the include/exclude button, and the shelf isn’t already selected, it will automatically select that shelf for you.  The assumption is that you must want to select that shelf or else there would be no point in clicking the button.

* Your final results will be a list of books that are found on all of your selected “include” shelves, minus any books that were found on your selected “exclude” shelves. 

 

In the below example, my results will contain all the books that are on both my “planning to read” and “fantasy” shelves, but which are not on my “standalone” shelf.  In Boolean terms, my results will be:  [planning to read] AND [fantasy] AND ![standalone].  In other words, I’ll get back a list of all the non-standalone fantasy books that I plan to read. 

 

 

If you use both grids, then the program will process each grid separately to get a list of results based on your selections within each grid.  Then it will combine those two sets of results into one list, without any duplicates.  In the below example, I would get back a list of the non-standalone fantasy books I plan to read plus the non-standalone science fiction books I plan to read.  In Boolean terms, my results will be: ([planning to read] AND [fantasy] AND ![standalone]) OR ([planning to read] AND [science fiction] AND ![standalone]).

 

 

When you get your results back, by default they’ll be sorted in Title order.  You can change the sorting by clicking on one of the underlined column headings.  If you click on the same column again, it will reverse the sort order.  Keep in mind that the data in these columns is only as good as the data in the BookLikes database.  If you see missing or bad data, and if you don’t already know how to get bad book data fixed, see the helpful guide that Bookstooge posted a while back.  Below is an example where I have my results sorted by the # of pages in descending order.

 

 

Additional Notes

As I said in my previous post about the Follower Comparison Tool, I’m still really inexperienced with this type of a programming environment, so I can’t promise this will be flawless perfection!

 

I think the biggest limitation of this tool is that you can only have one “OR” in your search.  I really wanted to allow the user to dynamically create new grids, allowing for an infinite number of “OR” searches, but I had to concede that this is beyond my current abilities.  Maybe if/when I gain more experience, and if people seem to be interested, I can expand the tool.  Meanwhile, there are a couple alternatives:

  1. If you have a spreadsheet program, you could run searches for two OR’s at a time and then copy/paste each result into a spreadsheet to be combined there. In Excel, there’s an advanced filter option called “unique records only” that automatically removes duplicates.
  2. In some cases, creative use of the “Exclude” option might get you what you need. You could select one of the major exclusive shelves and then use the Exclude option on all of the shelves you don’t want to see in your results. If you exclude a ton of shelves, just be prepared that it will run more slowly.  The program has to pull your book lists for every shelf you select and run through each of them to decide what to do.

 

The list of shelves is sorted in alphabetical order, except for the default exclusive shelves: Currently Reading, Planning to Read, and Read.  Those three sort to the top.  I figured they would be used a lot, plus we’re already used to seeing them listed above our other shelves.  If you have custom exclusive shelves, you’re going to be annoyed because they won’t show up at the top with the default shelves; they’ll be sorted alphabetically with the others.  It annoys me, anyway.  The data I get back from BookLikes doesn’t tell me which of your custom shelves are exclusive, so I don’t have any way to tell the program to recognize them and sort them to the top.

 

I tested a variety of search combinations to make sure I was getting back the expected results, but I have a simple shelf system (I don’t even have an “elves” shelf!) and only a little over 200 books.  I know a lot of you have more complicated shelving systems and thousands of books, so you’ll be able to run more complicated searches.  Let me know if any of your results don’t seem to be coming out correctly.  If it’s just a stray book or two, do double check how they’re shelved first.  There were several times when I thought the tool was wrong, but I’d actually just shelved some books wrong.  If your shelving is correct, please let me know what you searched for and what was wrong and I’ll investigate as soon as I can.

 

I actually see requests on Goodreads pretty often for Boolean shelf searches.  That’s how I got the idea for this tool in the first place.  Maybe, once I’m confident it’s working correctly for people here on BookLikes, I’ll see if I can do something similar for Goodreads.  Most of the work is already done, after all.  I’d just have to research Goodreads’ API and learn how to work with it to handle the data retrieval piece.