Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

Commit

Permalink
First stab at documention for new keyword arguments for #109 and #107
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Nov 22, 2015
1 parent 127f9d3 commit 21bd7a4
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion docs/documents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Retrieval
<Document: Final OIR Report>


.. function:: client.documents.search(keyword)
.. function:: client.documents.search(keyword, page=None, per_page=1000, mentions=3, data=False)

Return a list of documents that match the provided keyword. ::

Expand All @@ -26,6 +26,28 @@ Retrieval
>>> obj_list[0]
<Document: Final OIR Report>

DocumentCloud paginates search results. By default the search methods returns
from all pages. If you want to restrict the number of pages that are searched
or retrieve a specific page you should provide some combination of the following
keyword arguments.

>>> obj_list = client.documents.search('Ruben Salazar', page=1, per_page=10)
# You can guess that will do.
>>> len(obj_list) == 10
>>> True

By default, the search returns three mentions of the result in each document.
You can increase that number up to 10 by modifying the keyword argument.

>>> client.documents.search('Ruben Salazar', mentions=10)

Unlike when you get a document directly via id, the key/value dictionaries
they can be assigned are not provided by default in search results.

To have them included, switch the following keyword argument.

>> client.documents.search('Ruben Salazar', data=True)

Editing
-------

Expand Down

0 comments on commit 21bd7a4

Please sign in to comment.