Skip to content

Commit 3da8e3d

Browse files
committed
Updated SearchApi and respective tests and docs, regenerated the client
1 parent 806f5bd commit 3da8e3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+202
-174
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Manticore Search Client
55

66
- API version: 3.3.0
77

8-
- Build date: 2023-04-21T16:12:17.895346Z[Etc/UTC]
8+
- Build date: 2023-05-28T11:55:17.809597Z[Etc/UTC]
99

1010
Сlient for Manticore Search.
1111

docs/GeoDistanceFilterLocationAnchor.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Geo pin point object
88

99
| Name | Type | Description | Notes |
1010
|------------ | ------------- | ------------- | -------------|
11-
|**lat** | **Integer** | Geo latitude of pin point in degrees | [optional] |
12-
|**lon** | **Integer** | Geo longitude pf pin point in degrees | [optional] |
11+
|**lat** | **BigDecimal** | Geo latitude of pin point in degrees | [optional] |
12+
|**lon** | **BigDecimal** | Geo longitude pf pin point in degrees | [optional] |
1313

1414

1515

docs/SearchApi.md

Lines changed: 40 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:
@@ -59,18 +57,17 @@ Here is an example search response:
5957
}
6058
```
6159

62-
For more information about the match query syntax, additional paramaters that can be set to request and response, please check: https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP-JSON.
60+
For more information about the match query syntax, additional parameters that can be set to request and response, please check: https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP-JSON.
6361

6462

6563
### Example
6664
```java
6765

66+
import java.util.*;
6867
import com.manticoresearch.client.ApiClient;
6968
import com.manticoresearch.client.ApiException;
7069
import com.manticoresearch.client.Configuration;
7170
import com.manticoresearch.client.model.*;
72-
import com.manticoresearch.client.api.IndexApi;
73-
import com.manticoresearch.client.api.UtilsApi;
7471
import com.manticoresearch.client.api.SearchApi;
7572

7673
public class SearchApiExample {
@@ -122,10 +119,10 @@ No authorization required
122119
- **Accept**: application/json
123120

124121
### HTTP response details
125-
| Status code | Description | Response headers |
126-
|-------------|-------------|------------------|
127-
| **200** | Ok | - |
128-
| **0** | error | - |
122+
| Status code | Description |
123+
|-------------|-------------|
124+
| **200** | Success, query processed |
125+
| **500** | Server error |
129126

130127

131128
## percolate
@@ -134,14 +131,14 @@ No authorization required
134131
135132
Perform a reverse search on a percolate index
136133

137-
Performs a percolate search.
138134
This method must be used only on percolate indexes.
139135

140-
Expects two parameters: the index name and an object with an array of documents to be tested.
141-
An example of the documents object:
136+
Expects two parameters: the index name and an object with a document or an array of documents to search by.
137+
Here is an example of the object with a single document:
142138

143139
```
144-
{"query":
140+
{
141+
"query":
145142
{
146143
"percolate":
147144
{
@@ -193,17 +190,38 @@ Responds with an object with matched stored queries:
193190
}
194191
```
195192

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

197215
### Example
198216

199217
```java
200218
// Import classes:
219+
import java.util.*;
201220
import com.manticoresearch.client.ApiClient;
202221
import com.manticoresearch.client.ApiException;
203222
import com.manticoresearch.client.Configuration;
204223
import com.manticoresearch.client.model.*;
205224
import com.manticoresearch.client.api.SearchApi;
206-
import java.math.BigDecimal;
207225

208226
public class Example {
209227
public static void main(String[] args) {
@@ -214,15 +232,15 @@ public class Example {
214232

215233
try {
216234
PercolateRequest percolateRequest = new PercolateRequest();
217-
query = new HashMap<String,Object>(){{
235+
Map<String,Object> query = new HashMap<String,Object>(){{
218236
put("percolate",new HashMap<String,Object >(){{
219237
put("document", new HashMap<String,Object >(){{
220238
put("title","what a nice bag");
221239
}});
222240
}});
223241
}};
224242
percolateRequest.query(query);
225-
Object result = searchApi.percolate("products",percolateRequest);
243+
Object result = searchApi.percolate("products",percolateRequest);
226244
} catch (ApiException e) {
227245
System.err.println("Exception when calling SearchApi#percolate");
228246
System.err.println("Status code: " + e.getCode());
@@ -256,8 +274,8 @@ No authorization required
256274
- **Accept**: application/json
257275

258276
### HTTP response details
259-
| Status code | Description | Response headers |
260-
|-------------|-------------|------------------|
261-
| **200** | items found | - |
262-
| **0** | error | - |
277+
| Status code | Description |
278+
|-------------|-------------|
279+
| **200** | Success, query processed |
280+
| **500** | Server error |
263281

docs/SearchRequest.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Request object for search operation
1616
|**offset** | **Integer** | | [optional] |
1717
|**maxMatches** | **Integer** | | [optional] |
1818
|**sort** | **List&lt;Object&gt;** | | [optional] |
19-
|**sortOld** | **List&lt;Object&gt;** | | [optional] |
2019
|**aggs** | [**List&lt;Aggregation&gt;**](Aggregation.md) | | [optional] |
2120
|**expressions** | **List&lt;Object&gt;** | | [optional] |
2221
|**highlight** | [**Highlight**](Highlight.md) | | [optional] |

src/main/java/com/manticoresearch/client/ApiClient.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.manticoresearch.client;
22

33
import com.fasterxml.jackson.databind.ObjectMapper;
4+
import com.fasterxml.jackson.annotation.JsonInclude;
5+
import org.openapitools.jackson.nullable.JsonNullableModule;
46

57
import javax.ws.rs.client.Client;
68
import javax.ws.rs.client.ClientBuilder;
@@ -74,7 +76,7 @@
7476
/**
7577
* <p>ApiClient class.</p>
7678
*/
77-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-04-21T16:12:17.895346Z[Etc/UTC]")
79+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-05-28T11:55:17.809597Z[Etc/UTC]")
7880
public class ApiClient extends JavaTimeFormatter {
7981
private static final Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
8082

@@ -784,12 +786,15 @@ public Entity<?> serialize(Object obj, Map<String, Object> formParams, String co
784786
entity = Entity.entity(obj == null ? "null" : obj, contentType);
785787
}
786788
} else {
787-
if (obj instanceof SearchRequest) {
788-
ObjectMapper oMapper = new ObjectMapper();
789-
Map<String, Object> map = oMapper.convertValue(obj, Map.class);
790-
entity = Entity.entity(map, contentType);
789+
if (obj instanceof SearchRequest) {
790+
ObjectMapper oMapper = new ObjectMapper();
791+
oMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
792+
oMapper.registerModule(new JsonNullableModule());
793+
794+
Map<String, Object> map = oMapper.convertValue(obj, Map.class);
795+
entity = Entity.entity(map, contentType);
791796

792-
class SearchRequestRestruct {
797+
class SearchRequestRestruct {
793798
public Map<String, Object> restructObj(Map<String, Object> obj, String objType)
794799
{
795800
if (!obj.containsKey("attr") && !obj.containsKey("name") && !obj.containsKey("query_fields") && !obj.containsKey("value") && !obj.containsKey("values")
@@ -902,7 +907,7 @@ public Map<String, Object> restructNestedObj(List<Object> nestedObj, List<String
902907

903908
return (Map<String, Object>) nestedObj.get(0);
904909
}
905-
};
910+
};
906911

907912
SearchRequestRestruct restruct = new SearchRequestRestruct();
908913

@@ -922,7 +927,7 @@ public Map<String, Object> restructNestedObj(List<Object> nestedObj, List<String
922927
}
923928
}
924929
map.put("sort", restrSortList);
925-
}
930+
}
926931

927932
Boolean hasFilterSet = (map.containsKey("fulltext_filter") && map.get("fulltext_filter") != null) ||
928933
(map.containsKey("attr_filter") && map.get("attr_filter") != null);

src/main/java/com/manticoresearch/client/ApiException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* API Exception
2121
*/
22-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-04-21T16:12:17.895346Z[Etc/UTC]")
22+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-05-28T11:55:17.809597Z[Etc/UTC]")
2323
public class ApiException extends Exception {
2424
private int code = 0;
2525
private Map<String, List<String>> responseHeaders = null;

src/main/java/com/manticoresearch/client/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
package com.manticoresearch.client;
1515

16-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-04-21T16:12:17.895346Z[Etc/UTC]")
16+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-05-28T11:55:17.809597Z[Etc/UTC]")
1717
public class Configuration {
1818
private static ApiClient defaultApiClient = new ApiClient();
1919

src/main/java/com/manticoresearch/client/JSON.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import javax.ws.rs.core.GenericType;
1616
import javax.ws.rs.ext.ContextResolver;
1717

18-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-04-21T16:12:17.895346Z[Etc/UTC]")
18+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-05-28T11:55:17.809597Z[Etc/UTC]")
1919
public class JSON implements ContextResolver<ObjectMapper> {
2020
private ObjectMapper mapper;
2121

src/main/java/com/manticoresearch/client/JavaTimeFormatter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class.
2121
* It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}.
2222
*/
23-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-04-21T16:12:17.895346Z[Etc/UTC]")
23+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-05-28T11:55:17.809597Z[Etc/UTC]")
2424
public class JavaTimeFormatter {
2525

2626
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;

src/main/java/com/manticoresearch/client/Pair.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
package com.manticoresearch.client;
1515

16-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-04-21T16:12:17.895346Z[Etc/UTC]")
16+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-05-28T11:55:17.809597Z[Etc/UTC]")
1717
public class Pair {
1818
private String name = "";
1919
private String value = "";

0 commit comments

Comments
 (0)