Don't cache browses for the API

The API will never request it again, so caching the query just wastes
space.
Parameterise queries in Query
Abstract serialization within Query
Add naive compaction for Query serialization

Can be very efficient with the right input, but probably has
degenerative cases where it increases the size. Worst-case size
increase is one character per ID in the result set, so it shouldn't be
an issue.

String lengths for a large search result that was unstorable before:
serialize: 1991874
json_encode: 756249
cooked: 244

And some with more discontinuity:
serialize: 1772238
json_encode: 674751
cooked: 37950

serialize: 164942
json_encode: 65771
cooked: 25369