Skip to content

Commit 1b65abd

Browse files
committed
Update comments
1 parent 0748ac1 commit 1b65abd

File tree

2 files changed

+34
-22
lines changed

2 files changed

+34
-22
lines changed

meilisearch/client.py

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ def create_index(self, uid, options=None):
3232
Parameters
3333
----------
3434
uid: str
35-
UID of the index
35+
UID of the index.
3636
options: dict, optional
37-
Options passed during index creation (ex: primaryKey)
37+
Options passed during index creation (ex: primaryKey).
3838
3939
Returns
4040
-------
4141
index : Index
42-
An instance of Index containing the information of the newly created index
42+
An instance of Index containing the information of the newly created index.
4343
Raises
4444
------
4545
HTTPError
@@ -57,7 +57,7 @@ def get_indexes(self):
5757
In case of any error found here https://docs.meilisearch.com/references/#errors-status-code
5858
Returns
5959
-------
60-
list
60+
indexes: list
6161
List of indexes in dictionnary format. (e.g [{ 'uid': 'movies' 'primaryKey': 'objectID' }])
6262
"""
6363
return Index.list_all(self.config)
@@ -66,6 +66,11 @@ def get_index(self, uid):
6666
"""Get the index.
6767
This index should already exist.
6868
69+
Parameters
70+
----------
71+
uid: str
72+
UID of the index.
73+
6974
Raises
7075
------
7176
HTTPError
@@ -82,10 +87,15 @@ def index(self, uid):
8287
"""Create an Index instance.
8388
This method doesn't trigger any HTTP call.
8489
90+
Parameters
91+
----------
92+
uid: str
93+
UID of the index.
94+
8595
Returns
8696
-------
8797
index : Index
88-
An Index instance
98+
An Index instance.
8999
"""
90100
if uid is not None:
91101
return Index(self.config, uid=uid)
@@ -104,7 +114,7 @@ def get_or_create_index(self, uid, options=None):
104114
Returns
105115
-------
106116
index : Index
107-
An instance of Index containing the information of the retrieved or newly created index
117+
An instance of Index containing the information of the retrieved or newly created index.
108118
Raises
109119
------
110120
HTTPError
@@ -123,15 +133,16 @@ def get_all_stats(self):
123133
124134
Get information about database size and all indexes
125135
https://docs.meilisearch.com/references/stats.html
136+
126137
Returns
127-
----------
138+
-------
128139
stats: `dict`
129-
Dictionnary containing stats about your MeiliSearch instance
140+
Dictionnary containing stats about your MeiliSearch instance.
130141
"""
131142
return self.http.get(self.config.paths.stat)
132143

133144
def health(self):
134-
"""Get health of MeiliSearch
145+
"""Get health of the MeiliSearch server.
135146
136147
`204` HTTP status response when MeiliSearch is healthy.
137148
@@ -143,9 +154,9 @@ def health(self):
143154
return self.http.get(self.config.paths.health)
144155

145156
def get_keys(self):
146-
"""Get all keys created
157+
"""Get all keys.
147158
148-
Get list of all the keys that were created and all their related information.
159+
Get list of all the keys.
149160
150161
Returns
151162
----------
@@ -176,7 +187,7 @@ def version(self):
176187
return self.get_version()
177188

178189
def create_dump(self):
179-
"""Triggers the creation of a MeiliSearch dump
190+
"""Triggers the creation of a MeiliSearch dump.
180191
181192
Returns
182193
----------
@@ -187,15 +198,15 @@ def create_dump(self):
187198
return self.http.post(self.config.paths.dumps)
188199

189200
def get_dump_status(self, uid):
190-
"""Retrieves the status of a MeiliSearch dump creation
201+
"""Retrieves the status of a MeiliSearch dump creation.
191202
192203
Parameters
193204
----------
194205
uid: str
195-
UID of the dump
206+
UID of the dump.
196207
197208
Returns
198-
----------
209+
-------
199210
Dump status: dict
200211
Information about the dump status.
201212
https://docs.meilisearch.com/references/dump.html#get-dump-status

meilisearch/index.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ def __init__(self, config, uid, primary_key=None):
2424
config : Config
2525
Config object containing permission and location of MeiliSearch.
2626
uid: str
27-
Uid of the index on which to perform the index actions.
28-
index_path: str
29-
Index url path.
27+
UID of the index on which to perform the index actions.
28+
primary_key: str, optional
29+
Primary-key of the index.
3030
"""
3131
self.config = config
3232
self.http = HttpRequests(config)
@@ -44,12 +44,13 @@ def delete(self):
4444
return self.http.delete('{}/{}'.format(self.config.paths.index, self.uid))
4545

4646
def update(self, **body):
47-
"""Update the index.
47+
"""Update the index primary-key.
4848
4949
Parameters
5050
----------
5151
body: **kwargs
5252
Accepts primaryKey as an updatable parameter.
53+
Ex: index.update(primaryKey='name')
5354
5455
Returns
5556
-------
@@ -82,7 +83,7 @@ def get_primary_key(self):
8283
Returns
8384
-------
8485
primary_key: str
85-
String containing primary key.
86+
String containing the primary key.
8687
"""
8788
self.primary_key = self.fetch_info()['primaryKey']
8889
return self.primary_key
@@ -114,12 +115,12 @@ def create(config, uid, options=None):
114115

115116
@staticmethod
116117
def list_all(config):
117-
"""Get all indexes
118+
"""Get all indexes.
118119
119120
Returns
120121
-------
121122
indexes : list
122-
List of indexes. Each index is a dictionnary.
123+
List of the indexes. Each index is a dictionnary.
123124
Raises
124125
------
125126
HTTPError

0 commit comments

Comments
 (0)