Skip to content

Commit b95fdb3

Browse files
committed
Updated docs and Readme
1 parent 1d65625 commit b95fdb3

File tree

3 files changed

+15
-42
lines changed

3 files changed

+15
-42
lines changed

docs/SearchApi.md

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,45 +19,18 @@ The method expects an object with the following mandatory properties:
1919

2020
* the match query object
2121

22-
Here is an example search request:
23-
```
24-
{
25-
'index':'movies',
26-
'query':
27-
{
28-
'bool':
29-
{
30-
'must':[{'query_string':' movie'}]
31-
}
32-
},
33-
'script_fields':
34-
{
35-
'myexpr':
36-
{
37-
'script':{'inline':'IF(rating>8,1,0)'
38-
}
39-
},
40-
'sort':
41-
[
42-
{'myexpr':'desc'},
43-
{'_score':'desc'}
44-
],
45-
'profile':true
46-
}
47-
```
48-
49-
Alternatively, you can use auxiliary objects to build your search query. For details, see the documentation on [**SearchRequest**](SearchRequest.md)
22+
For details, see the documentation on [**SearchRequest**](SearchRequest.md)
5023

5124
The method returns an object with the following properties:
5225

53-
- took: the time taken to execute the search query.
54-
- timed_out: a boolean indicating whether the query timed out.
5526
- hits: an object with the following properties:
56-
- total: the total number of hits found.
5727
- hits: an array of hit objects, where each hit object represents a matched document. Each hit object has the following properties:
5828
- _id: the ID of the matched document.
5929
- _score: the score of the matched document.
6030
- _source: the source data of the matched document.
31+
- total: the total number of hits found.
32+
- timed_out: a boolean indicating whether the query timed out.
33+
- took: the time taken to execute the search query.
6134

6235
In addition, if profiling is enabled, the response will include an additional array with profiling information attached.
6336

@@ -165,20 +138,20 @@ This method must be used only on percolate indexes.
165138
Expects two parameters: the index name and an object with an array of documents to search with.
166139
Here is an example of the document object:
167140

168-
```
141+
```
142+
{
143+
"query":
169144
{
170-
"query":
145+
"percolate":
171146
{
172-
"percolate":
147+
"document":
173148
{
174-
"document":
175-
{
176-
"content":"sample content"
177-
}
149+
"content":"sample content"
178150
}
179151
}
180152
}
181-
```
153+
}
154+
```
182155

183156
Responds with an object with matched stored queries:
184157

docs/SearchRequest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SearchRequest
22

3-
Payload for search operation
3+
Request object for search operation
44
## Properties
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------

manticoresearch/api/search_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def percolate_with_http_info(self, index, percolate_request, **kwargs): # noqa:
186186
def search(self, search_request, **kwargs): # noqa: E501
187187
"""Performs a search on an index # noqa: E501
188188
189-
The method expects an object with the following mandatory properties: * the name of the index to search * the match query object Here is an example search request: ``` { 'index':'movies', 'query': { 'bool': { 'must':[{'query_string':' movie'}] } }, 'script_fields': { 'myexpr': { 'script':{'inline':'IF(rating>8,1,0)' } }, 'sort': [ {'myexpr':'desc'}, {'_score':'desc'} ], 'profile':true } ``` Alternatively, you can use auxiliary objects to build your search query. For details, see the documentation on [**SearchRequest**](SearchRequest.md) The method returns an object with the following properties: - took: the time taken to execute the search query. - timed_out: a boolean indicating whether the query timed out. - hits: an object with the following properties: - total: the total number of hits found. - hits: an array of hit objects, where each hit object represents a matched document. Each hit object has the following properties: - _id: the ID of the matched document. - _score: the score of the matched document. - _source: the source data of the matched document. In addition, if profiling is enabled, the response will include an additional array with profiling information attached. Here is an example search response: ``` { 'took':10, 'timed_out':false, 'hits': { 'total':2, 'hits': [ {'_id':'1','_score':1,'_source':{'gid':11}}, {'_id':'2','_score':1,'_source':{'gid':12}} ] } } ``` For more information about the match query syntax and additional parameters that can be added to request and response, please see the documentation [here](https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP-JSON). # noqa: E501
189+
The method expects an object with the following mandatory properties: * the name of the index to search * the match query object For details, see the documentation on [**SearchRequest**](SearchRequest.md) The method returns an object with the following properties: - took: the time taken to execute the search query. - timed_out: a boolean indicating whether the query timed out. - hits: an object with the following properties: - total: the total number of hits found. - hits: an array of hit objects, where each hit object represents a matched document. Each hit object has the following properties: - _id: the ID of the matched document. - _score: the score of the matched document. - _source: the source data of the matched document. In addition, if profiling is enabled, the response will include an additional array with profiling information attached. Here is an example search response: ``` { 'took':10, 'timed_out':false, 'hits': { 'total':2, 'hits': [ {'_id':'1','_score':1,'_source':{'gid':11}}, {'_id':'2','_score':1,'_source':{'gid':12}} ] } } ``` For more information about the match query syntax and additional parameters that can be added to request and response, please see the documentation [here](https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP-JSON). # noqa: E501
190190
This method makes a synchronous HTTP request by default. To make an
191191
asynchronous HTTP request, please pass async_req=True
192192
@@ -216,7 +216,7 @@ def search(self, search_request, **kwargs): # noqa: E501
216216
def search_with_http_info(self, search_request, **kwargs): # noqa: E501
217217
"""Performs a search on an index # noqa: E501
218218
219-
The method expects an object with the following mandatory properties: * the name of the index to search * the match query object Here is an example search request: ``` { 'index':'movies', 'query': { 'bool': { 'must':[{'query_string':' movie'}] } }, 'script_fields': { 'myexpr': { 'script':{'inline':'IF(rating>8,1,0)' } }, 'sort': [ {'myexpr':'desc'}, {'_score':'desc'} ], 'profile':true } ``` Alternatively, you can use auxiliary objects to build your search query. For details, see the documentation on [**SearchRequest**](SearchRequest.md) The method returns an object with the following properties: - took: the time taken to execute the search query. - timed_out: a boolean indicating whether the query timed out. - hits: an object with the following properties: - total: the total number of hits found. - hits: an array of hit objects, where each hit object represents a matched document. Each hit object has the following properties: - _id: the ID of the matched document. - _score: the score of the matched document. - _source: the source data of the matched document. In addition, if profiling is enabled, the response will include an additional array with profiling information attached. Here is an example search response: ``` { 'took':10, 'timed_out':false, 'hits': { 'total':2, 'hits': [ {'_id':'1','_score':1,'_source':{'gid':11}}, {'_id':'2','_score':1,'_source':{'gid':12}} ] } } ``` For more information about the match query syntax and additional parameters that can be added to request and response, please see the documentation [here](https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP-JSON). # noqa: E501
219+
The method expects an object with the following mandatory properties: * the name of the index to search * the match query object For details, see the documentation on [**SearchRequest**](SearchRequest.md) The method returns an object with the following properties: - took: the time taken to execute the search query. - timed_out: a boolean indicating whether the query timed out. - hits: an object with the following properties: - total: the total number of hits found. - hits: an array of hit objects, where each hit object represents a matched document. Each hit object has the following properties: - _id: the ID of the matched document. - _score: the score of the matched document. - _source: the source data of the matched document. In addition, if profiling is enabled, the response will include an additional array with profiling information attached. Here is an example search response: ``` { 'took':10, 'timed_out':false, 'hits': { 'total':2, 'hits': [ {'_id':'1','_score':1,'_source':{'gid':11}}, {'_id':'2','_score':1,'_source':{'gid':12}} ] } } ``` For more information about the match query syntax and additional parameters that can be added to request and response, please see the documentation [here](https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP-JSON). # noqa: E501
220220
This method makes a synchronous HTTP request by default. To make an
221221
asynchronous HTTP request, please pass async_req=True
222222

0 commit comments

Comments
 (0)