Over the past two years, we have released much of our toolset as open-source code: Backbone.js, Underscore.js, Jammit, CloudCrowd, and others. Today, we’re launching another piece of DocumentCloud — both on DocumentCloud.org and as a component you can integrate into your own projects. VisualSearch.js is a rich search box for real data. It enhances ordinary search boxes with the ability to autocomplete facets and values for sophisticated searches.

For example, here’s a query that filters The New York Times’ copies of Sarah Palin’s recently-released emails. First we filter just the annotated emails, then just the emails from 2007, and then drill down to a specific date. Visual search works with the arbitrary metadata you’ve already added to your documents.

You can use VisualSearch.js on your site by including the necessary JavaScript, CSS, images, and dependencies. All of these files are outlined on the VisualSearch.js site on GitHub. The complete annotated source code is also available. You can customize the categories and facet values to be either arrays of values or fetched from a server with an AJAX callback. You can change which facets need quotes (titles, names, etc) and which are fine as a single word (slugs, single word filters, etc). The parsed search query is available as a JSON object, so you don’t have to manually re-parse it yourself.

We are excited to not only see what clever uses developers come up with for VisualSearch, but also what additions you write that can be merged back into the main repository.