Made query_by_example more useful

In its former incarnation, query_by_example was not every useful as it only fetched data. Now it can be used in combination with all methods that require a query argument.