sampsyo/beets — pull request #214 by phmongeau (2013-03-11 01:09:23+00:00)
Title: Extend query syntax from plugins

Plugins can add custom query types using the `PluginQuery` class.

I added a `BeetsPlugin.queries()` function that returns a dict of `{prefix: PluginQuery}`.
Then, when we parse the queries, I check if the search term starts with one of the registered prefix and use the associated `PluginQuery` as if it was a normal `FieldQuery`.

If the search is on all fields, I use the `AnyPluginQuery` which dispatches the matching function to a class we provide in the constructor. A made the `RegexpQuery` also use `AnyPluginQuery`, but kept the `AnyRegexpQuery` class in case we want to continue using it.

I also update the fuzzy plugin to use this new system.

I still need to update the documentation and some docstrings, but I wanted to have your thoughts on this implementation before going further.