Result filtering on search (also known as Partial Search)

First take at refactoring search to allow selective results, rather than returning the whole thing.
This seems to do almost exactly the same thing as the current `-a` option. Is it possible to infer the filter from the `-a` option instead?