Smarter Searching with VideoDB

I use VideoDB to keep track of my movie collection. When I’m looking for something to watch out of the collection, often I like to perform a search over the database with some advanced criteria. It’s no secret that the current search features built in to VideoDB are simple at best: you select some search fields and provide some search terms, optionally narrowing by category in addition to said terms and fields. What I wanted was something a little bit more advanced in order to answer queries such as “show me all of my movies from last year that I haven’t seen yet.” With my new advanced search, I can.

What You Can Do With It

The new advanced search should be very familiar to anyone who uses recent versions of Mac OS X, as I’ve modeled it after the same UI concepts that Apple put together for Smart Playlists in iTunes, Smart Folders in Finder, and Smart Mailboxes in Mail. The basic idea is that you add one row to a search table per criteria, adding as many criteria as you desire. Each criteria corresponds to a simple query clause, such as “unseen movies,” “movies from 2007″ or “movies not in English”. These search criteria are combined (to match either ‘all’ of those criteria, or ‘any’, depending on your input) to create a complex compound query, such as “Non-English movies from 2007 that I haven’t seen.” Combine this with some fancy AJAX for dynamic results display and paging, and you have my complete advanced search package.

How It Was Written

I wrote the search new advanced search page using the existing simple search page as reference. All of the new JavaScript was written from scratch and tested independently on a built-from-the-ground-up test bed, having nothing to do with VideoDB or my database. For this small project I delved for the first time into that great Prototype library I’ve heard so much about. I must say, it cut my total development time down by quite a bit and took most of the pain out of JavaScript DOM calls. While it’s nothing groundbreaking, the convenience factor is definitely very much appreciated.

Where It’ll Go From Here

So far, this little project is pretty much in a ‘works for me’ state. I won’t be spending exuberant amounts of time on it, but at some point I would like to clean up the code and submit it as patches to the VideoDB team. As I understand, not only are they relatively open to outside support and patches, but they’ve been actively working on the project as of late as well. Hooray for open source software. Some things that’ll need to be cleaned up is some of the internationalization code that we’ve come to expect from VideoDB that just isn’t there in the new portions that I created, as well as some parameterization issues with regards to how select boxes are created and drawn for selecting criteria (not everything is dynamically generated that should be).

Don’t hold your breath, but there may be more to come around the corner.

1 Response to “Smarter Searching with VideoDB”


Leave a Reply

Related Posts (YARPP)

No related posts.