Revise search_raw

As described in #86, all query transformation stuff is moved from `_Model` to `store.py`, making `_Model.search_raw` a thin wrapper around doing a Elasticsearch search; the only help being that the index name and document type are filled in for you.

Annotation.search_raw like before adds a filter to the query, to comply with annotation permissions. I added the option to disable this authorization filter.

Fine with me. It was probably left over from when we used a pyes.
On Aug 6, 2014 3:47 PM, "Gerben" <notifications@github.com> wrote:

> In annotator/elasticsearch.py:
>
> > -            return q
> > -        try:
> > -            res = cls.es.conn.search(index=cls.es.index,
> > -                                     doc_type=cls.__type__,
> > -                                     body=q,
> > -                                     **params)
> > -        except elasticsearch.exceptions.ElasticsearchException as e:
> > -            return e.result
> > -        else:
> > -            return res
> > +    def search_raw(cls, query=None, params=None, **kwargs):
> > +        if query is None:
> > +            query = {}
> > +        if params is None:
> > +            params = {}
> > +        res = cls.es.conn.search(index=cls.es.index,
>
>  It looks like the error case behaviour here was changed. Do we want to
> return `e.result` like in the old code or allow exceptions to bubble?
> The funny thing is that ElasticsearchException does not even have a
> `result` property, so I'm not sure what the old behaviour was supposed to
> be. :) I opted for just returning Elasticsearch exceptions. Abstracting
> them seems like unnecessary complication, as raw searches are very
> ES-specific in any case.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/openannotation/annotator-store/pull/87/files#r15908963>
> .
>