Skip to content

Commit

Permalink
Fixed documentation on how to use DocTypes with raw Search object
Browse files Browse the repository at this point in the history
Fixes #60 Thanks  assumptionsoup!
  • Loading branch information
honzakral committed Jan 27, 2015
1 parent 60a1123 commit cd19bb5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/persistence.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@ To search for this document type, use the ``search`` class method:
for posts in results:
print(post._meta.score, post.title)
Alternatively you can just take a ``Search`` object and restrict it to return
our document type, wrapped in correct class:
Alternatively you can just take a ``Search`` object and register the
``from_es`` method of you document class as a callback for certain document
types:

.. code:: python
s = Search()
s = s.doc_type(Post)
s = s.doc_type(post=Post.from_es)
You can also combine document classes with standard doc types (just strings),
which will be treated as before. You can also pass in multiple ``DocType``
Expand Down

0 comments on commit cd19bb5

Please sign in to comment.