Skip to content

Commit 88fcdf1

Browse files
committed
Updated SearchApi and respective tests and docs, regenerated the client
1 parent b95fdb3 commit 88fcdf1

File tree

8 files changed

+149
-105
lines changed

8 files changed

+149
-105
lines changed

docs/GeoDistanceFilterLocationAnchor.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Geo pin point object
44
## Properties
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**lat** | **int** | Geo latitude of pin point in degrees | [optional]
8-
**lon** | **int** | Geo longitude pf pin point in degrees | [optional]
7+
**lat** | **float** | Geo latitude of pin point in degrees | [optional]
8+
**lon** | **float** | Geo longitude pf pin point in degrees | [optional]
99

1010

1111
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

docs/RangeFilter.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Range attribute filter
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**field** | **str** | |
8-
**lte** | **float** | | [optional]
9-
**gte** | **float** | | [optional]
10-
**lt** | **float** | | [optional]
11-
**gt** | **float** | | [optional]
8+
**lte** | **float, none_type** | | [optional]
9+
**gte** | **float, none_type** | | [optional]
10+
**lt** | **float, none_type** | | [optional]
11+
**gt** | **float, none_type** | | [optional]
1212

1313
[[Using in search requests]](SearchRequest.md#RangeFilter)
1414

docs/SearchApi.md

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ Method | HTTP request | Description
1313
1414
Performs a search on an index.
1515

16-
The method expects an object with the following mandatory properties:
16+
The method expects a SearchRequest object with the following mandatory properties:
1717

18-
* the name of the index to search
18+
* the name of the index to search | string
1919

20-
* the match query object
21-
2220
For details, see the documentation on [**SearchRequest**](SearchRequest.md)
2321

2422
The method returns an object with the following properties:
@@ -80,13 +78,15 @@ with manticoresearch.ApiClient(configuration) as api_client:
8078
# Create SearchRequest
8179
search_request = SearchRequest()
8280
search_request.index='test'
83-
search_request.fullltext_filter=QueryFilter('find smth')
81+
search_request.fulltext_filter=QueryFilter('find smth')
8482

85-
# or create SearchRequest in an alternative way
83+
# or create SearchRequest in an alternative way as in the previous versions of the client. It uses a single complex JSON object for a query field
8684
search_request = SearchRequest(
8785
index='test',
8886
query={'query_string': 'find smth'},
89-
)
87+
)
88+
89+
# Both ways of creating SearchRequest are interchangeable and produce the same result
9090

9191
# example passing only required values which don't have defaults set
9292
try:
@@ -119,24 +119,23 @@ No authorization required
119119
- **Accept**: application/json
120120

121121
### HTTP response details
122-
| Status code | Description | Response headers |
123-
|-------------|-------------|------------------|
124-
**200** | Ok | - |
125-
**0** | error | - |
122+
| Status code | Description |
123+
|-------------|-------------|
124+
**200** | Success, query processed |
125+
**500** | Server error |
126126

127127
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
128128

129129

130130
## **percolate**
131131
> SearchResponse percolate(index,percolate_request)
132132
133-
Perform a reverse search on a percolate index
133+
Perform a reverse search on a percolate index. [[More info on percolate indexes in Manticore Search Manual]](https://manual.manticoresearch.com/Creating_a_table/Local_tables/Percolate_table#Percolate-table)
134134

135-
Performs a percolate search.
136135
This method must be used only on percolate indexes.
137136

138-
Expects two parameters: the index name and an object with an array of documents to search with.
139-
Here is an example of the document object:
137+
Expects two parameters: the index name and an object with a document or an array of documents to search by.
138+
Here is an example of the object with a single document:
140139

141140
```
142141
{
@@ -195,6 +194,26 @@ Responds with an object with matched stored queries:
195194
}
196195
```
197196

197+
And here is an example of the object with multiple documents:
198+
199+
```
200+
{
201+
"query":
202+
{
203+
"percolate":
204+
{
205+
"documents": [
206+
{
207+
"content":"sample content"
208+
},
209+
{
210+
"content":"another sample content"
211+
}
212+
]
213+
}
214+
}
215+
}
216+
```
198217

199218
### Example
200219

@@ -204,6 +223,7 @@ from manticoresearch.api import search_api
204223
from manticoresearch.model.error_response import ErrorResponse
205224
from manticoresearch.model.search_response import SearchResponse
206225
from manticoresearch.model.percolate_request import PercolateRequest
226+
from manticoresearch.model.percolate_request_query import PercolateRequestQuery
207227
from pprint import pprint
208228

209229
# Defining the host is optional and defaults to http://127.0.0.1:9308
@@ -218,9 +238,18 @@ with manticoresearch.ApiClient(configuration) as api_client:
218238
# Create an instance of the API class
219239
api_instance = search_api.SearchApi(api_client)
220240

221-
index = "index_example" # str |( Name of the percolate index
241+
index = "index_example" # str | Name of the percolate index
242+
percolate_query = {
243+
"query": {
244+
"percolate": {
245+
"document": {
246+
"content":"sample content"
247+
}
248+
}
249+
}
250+
}
222251
percolate_request = PercolateRequest(
223-
query=PercolateRequestQuery(),
252+
query=PercolateRequestQuery(percolate_query),
224253
) # PercolateRequest
225254

226255
# example passing only required values which don't have defaults set
@@ -231,7 +260,6 @@ with manticoresearch.ApiClient(configuration) as api_client:
231260
except manticoresearch.ApiException as e:
232261
print("Exception when calling SearchApi->percolate: %s\n" % e)
233262

234-
235263
```
236264

237265
### Parameters
@@ -255,10 +283,10 @@ No authorization required
255283
- **Accept**: application/json
256284

257285
### HTTP response details
258-
| Status code | Description | Response headers |
259-
|-------------|-------------|------------------|
260-
**200** | items found | - |
261-
**0** | error | - |
286+
| Status code | Description |
287+
|-------------|-------------|
288+
**200** | Success, query processed |
289+
**500** | Server error |
262290

263291
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
264292

docs/SearchRequest.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Name | Type | Description | Notes
1212
**offset** | **int** | | [optional]
1313
**max_matches** | **int** | | [optional]
1414
**sort** | **[{str: (bool, date, datetime, dict, float, int, list, str, none_type)}]** | | [optional]
15-
**sort_old** | **[{str: (bool, date, datetime, dict, float, int, list, str, none_type)}]** | | [optional]
1615
**aggs** | [**[Aggregation]**](Aggregation.md) | | [optional]
1716
**expressions** | **[{str: (bool, date, datetime, dict, float, int, list, str, none_type)}]** | | [optional]
1817
**highlight** | [**Highlight**](Highlight.md) | | [optional]

manticoresearch/model/geo_distance_filter_location_anchor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class GeoDistanceFilterLocationAnchor(object):
3030
and the value is json key in definition.
3131
"""
3232
openapi_types = {
33-
'lat': 'int',
34-
'lon': 'int'
33+
'lat': 'float',
34+
'lon': 'float'
3535
}
3636

3737
attribute_map = {
@@ -61,7 +61,7 @@ def lat(self):
6161
Geo latitude of pin point in degrees # noqa: E501
6262
6363
:return: The lat of this GeoDistanceFilterLocationAnchor. # noqa: E501
64-
:rtype: int
64+
:rtype: float
6565
"""
6666
return self._lat
6767
@lat.setter
@@ -71,7 +71,7 @@ def lat(self, lat):
7171
Geo latitude of pin point in degrees # noqa: E501
7272
7373
:param lat: The lat of this GeoDistanceFilterLocationAnchor. # noqa: E501
74-
:type lat: int
74+
:type lat: float
7575
"""
7676

7777
self._lat = lat
@@ -84,7 +84,7 @@ def lon(self):
8484
Geo longitude pf pin point in degrees # noqa: E501
8585
8686
:return: The lon of this GeoDistanceFilterLocationAnchor. # noqa: E501
87-
:rtype: int
87+
:rtype: float
8888
"""
8989
return self._lon
9090
@lon.setter
@@ -94,7 +94,7 @@ def lon(self, lon):
9494
Geo longitude pf pin point in degrees # noqa: E501
9595
9696
:param lon: The lon of this GeoDistanceFilterLocationAnchor. # noqa: E501
97-
:type lon: int
97+
:type lon: float
9898
"""
9999

100100
self._lon = lon

manticoresearch/model/range_filter.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ class RangeFilter(object):
3131
"""
3232
openapi_types = {
3333
'field': 'str',
34-
'lte': 'float',
35-
'gte': 'float',
36-
'lt': 'float',
37-
'gt': 'float'
34+
'lte': 'float, none_type',
35+
'gte': 'float, none_type',
36+
'lt': 'float, none_type',
37+
'gt': 'float, none_type'
3838
}
3939

4040
attribute_map = {
@@ -59,14 +59,10 @@ def __init__(self, field=None, lte=None, gte=None, lt=None, gt=None, local_vars_
5959
self.discriminator = None
6060

6161
self.field = field
62-
if lte is not None:
63-
self.lte = lte
64-
if gte is not None:
65-
self.gte = gte
66-
if lt is not None:
67-
self.lt = lt
68-
if gt is not None:
69-
self.gt = gt
62+
self.lte = lte
63+
self.gte = gte
64+
self.lt = lt
65+
self.gt = gt
7066

7167
@property
7268
def field(self):
@@ -97,7 +93,7 @@ def lte(self):
9793
9894
9995
:return: The lte of this RangeFilter. # noqa: E501
100-
:rtype: float
96+
:rtype: float, none_type
10197
"""
10298
return self._lte
10399
@lte.setter
@@ -106,7 +102,7 @@ def lte(self, lte):
106102
107103
108104
:param lte: The lte of this RangeFilter. # noqa: E501
109-
:type lte: float
105+
:type lte: float, none_type
110106
"""
111107

112108
self._lte = lte
@@ -118,7 +114,7 @@ def gte(self):
118114
119115
120116
:return: The gte of this RangeFilter. # noqa: E501
121-
:rtype: float
117+
:rtype: float, none_type
122118
"""
123119
return self._gte
124120
@gte.setter
@@ -127,7 +123,7 @@ def gte(self, gte):
127123
128124
129125
:param gte: The gte of this RangeFilter. # noqa: E501
130-
:type gte: float
126+
:type gte: float, none_type
131127
"""
132128

133129
self._gte = gte
@@ -139,7 +135,7 @@ def lt(self):
139135
140136
141137
:return: The lt of this RangeFilter. # noqa: E501
142-
:rtype: float
138+
:rtype: float, none_type
143139
"""
144140
return self._lt
145141
@lt.setter
@@ -148,7 +144,7 @@ def lt(self, lt):
148144
149145
150146
:param lt: The lt of this RangeFilter. # noqa: E501
151-
:type lt: float
147+
:type lt: float, none_type
152148
"""
153149

154150
self._lt = lt
@@ -160,7 +156,7 @@ def gt(self):
160156
161157
162158
:return: The gt of this RangeFilter. # noqa: E501
163-
:rtype: float
159+
:rtype: float, none_type
164160
"""
165161
return self._gt
166162
@gt.setter
@@ -169,7 +165,7 @@ def gt(self, gt):
169165
170166
171167
:param gt: The gt of this RangeFilter. # noqa: E501
172-
:type gt: float
168+
:type gt: float, none_type
173169
"""
174170

175171
self._gt = gt

0 commit comments

Comments
 (0)