Refactor `filter_collection` to fix two issues

* `context` attribute was being filtered out, but it should always be
  present on an object
* `filter_relationship_attrs` should be called recursively in case of
  nested resources or stubs
Multiple changes to support Memcache in collection requests

* Break `collection_get` implementation into components:
  - `get_collection_matches` to return tuples with stub information
  - `apply_paging` to apply paging regardless of query type (search,
    stubs_only, etc)
  - directly generate stubs from `matches` (this should be elsewhere,
    but currently `matches` is poorly abstracted)
  - `get_matched_resources` uses `matches` to fetch resources from cache
    with fallback to database on per-match basis
  - `build_collection_representation` adds the "envelope" around the
    resource list
  - `filter_resource` removes items and stubs the user is not allowed to
    see (needs optimization)
Add search-related parameters to collection endpoints

* `__search=<term>` searches full text index, but returns full resources
  (instead of just stubs) and is paging-enabled
* `__mywork` (only valid in tandem with `__search`) restricts results to
  "MyWork" results
Merge pull request #1268 from reciprocity/feature/fix-context-permissions

Fix context permissions and other memcache issues