Skip to content

Commit 56a91fe

Browse files
authored
Merge pull request #24 from marklogic/feature/docs-tweak
Added list of values for categories in docs for searching
2 parents 0b11332 + 04c6c3a commit 56a91fe

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

docs/managing-documents/reading.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,19 @@ A list of `Document` instances can be obtained for a list of URIs, where each `D
3535
attributes populated but no metadata by default:
3636

3737
```
38+
# Read multiple documents via a list of URIs.
3839
docs = client.documents.read(["/doc1.json", "/doc2.xml", "/doc3.bin"])
3940
assert len(docs) == 3
41+
42+
# Read a single document, verifying that it does not have any metadata.
43+
doc = client.documents.read("/doc1.json")[0]
44+
assert "/doc1.json" == doc.uri
45+
assert "example one" == doc.content["text"]
46+
assert doc.collections is None
47+
assert doc.permissions is None
48+
assert doc.quality is None
49+
assert doc.metadata_values is None
50+
assert doc.properties is None
4051
```
4152

4253
The [requests toolbelt](https://toolbelt.readthedocs.io/en/latest/) library is used to process the multipart
@@ -100,6 +111,9 @@ docs = client.documents.read(uris, params={"database": "Documents"})
100111
print(docs)
101112
```
102113

114+
Please see [the application developer's guide](https://docs.marklogic.com/guide/rest-dev/documents#id_80116)
115+
for more information on reading documents.
116+
103117
## Error handling
104118

105119
If the `client.documents.read` method receives an HTTP response with a status code of 200, then the client will return

docs/managing-documents/searching.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,11 @@ docs = client.documents.search(collections=["python-search-example"])
124124
assert len(docs) == 2
125125
```
126126

127-
Similar to [reading documents](reading.md), you can use the `categories` argument to control what is returned for
128-
each matching document:
127+
Metadata for each document can be retrieved via the `categories` argument. The acceptable values for this argument
128+
match those of the `category` parameter in the [search endpoint](https://docs.marklogic.com/REST/POST/v1/search)
129+
documentation: `content`, `metadata`, `metadata-values`, `collections`, `permissions`, `properties`, and `quality`.
130+
131+
The following shows different examples of configuring the `categories` argument:
129132

130133
```
131134
# Retrieve all content and metadata for each matching document.
@@ -149,6 +152,9 @@ docs = client.documents.search("hello", params={"database": "Documents"})
149152
assert len(docs) == 2
150153
```
151154

155+
Please see [the application developer's guide](https://docs.marklogic.com/guide/rest-dev/search#id_49329)
156+
for more information on searching documents.
157+
152158
## Error handling
153159

154160
If the `client.documents.read` method receives an HTTP response with a status code of 200, then the client will return

docs/managing-documents/writing.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ normally pass to `requests`. For example:
147147
response = client.documents.write(Document("/doc1.json", {"doc": 1}, permissions=default_perms), params={"database": "Documents"})
148148
```
149149

150+
Please see [the application developer's guide](https://docs.marklogic.com/guide/rest-dev/documents#id_11953) for
151+
more information on writing documents.
152+
150153
## Error handling
151154

152155
Because the `client.documents.write` method returns a `requests Response` object, any error that occurs during

0 commit comments

Comments
 (0)