Improve has/any search. Fixes jfinkels/flask-restless#180