clojuredocs/web — pull request #2 by ecmendenhall (2013-09-11 16:10:19+00:00)
Title: Refactor API interface, add versioning, tweak search results

I noticed some [clojuredocs talk](https://groups.google.com/forum/#!topic/clojure/QpZtgWEGY-0) on the mailing list and wanted to push some of my changes and open them for discussion here.

## Changes
- Refactor the API: It returned JSON by default, but I'd like EDN and plaintext, too. I've abstracted the API functions to take an encoder function as an argument. Concrete implementations can pass in a custom encoder, or fix one by defining partials.
- Add versioning to document ids. Documents were indexed with a hash of groupname and name, so different versions of the same var collided, and multiple versions could not be inserted simultaneously. I've changed document id to a hash of groupname, name, and version.
- Boost name score in search queries. Searches are almost always for var name (although not always _by_ var name directly), but search results were biased towards hits in which the query occurred frequently in the arglist/source. For instance, a search for `map` returned `dissoc` as the top hit, since it operates on maps and takes `map` as an arg. Search results with a fuzzy match in the name field now get a boost at query time.
- Remove web routes and web dependencies. This is an awesome, clean, simple API. As I added features to the web frontend, I needed different tools and a more complex structure: Ring middlewares, more complex route handling, handlers and templates, etc. If there are no objections, I'd like to separate the projects. (I'll push my web project and add a link once it's up).