remove unwanted locals from database query results

Some local variables, namely a temporary used for iteration over entries
and the parsed version of the query string, were leaking out of the
`query` method of the Root class.
improve REST API with general querying similar to IRC bots

Using the route /api/query/<querystring>, users of the vlasisku API can
make queries similar to those from the IRC bot, using a colon-separated
query string, e.g. "finti:djeikyb", "type:gismu", or simply a string
like "coi" or "hello" which searches in all fields.