diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 32b9d1e..c64d1ae 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,7 +31,13 @@ jobs: java-version: ${{ matrix.java }} distribution: 'temurin' cache: maven - - name: Use Maven + - name: Check for dev-version + if: ${{ contains(github.ref, 'master') }} + run: | + VERSION=`git log -1 --date=format:"%y%m%d%H" --format=%cd-%h|head` + echo "version $VERSION" + sed -i -E "s/(\)([0-9]\.[0-9]\.)(.*)(\<)/\1\2$VERSION\4/1" pom.xml + - name: Publish run: | mkdir -p ~/.m2 export GPG_TTY=$(tty) diff --git a/README.md b/README.md index 6e77db1..8311648 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Building the API client library requires: -1. Java 1.8+ +1. Java 17+ 2. Maven/Gradle | Manticore Search | manticoresearch-java | @@ -143,6 +143,7 @@ Class | Method | HTTP request | Description *IndexApi* | [**insert**](docs/IndexApi.md#insert) | **POST** /insert | Create a new document in an index *IndexApi* | [**replace**](docs/IndexApi.md#replace) | **POST** /replace | Replace new document in an index *IndexApi* | [**update**](docs/IndexApi.md#update) | **POST** /update | Update a document in an index +*IndexApi* | [**update_0**](docs/IndexApi.md#update_0) | **POST** /{index}/_update/{id} | Partially replaces a document in an index *SearchApi* | [**percolate**](docs/SearchApi.md#percolate) | **POST** /pq/{index}/search | Perform reverse search on a percolate index *SearchApi* | [**search**](docs/SearchApi.md#search) | **POST** /search | Performs a search on an index *UtilsApi* | [**sql**](docs/UtilsApi.md#sql) | **POST** /sql | Perform SQL requests @@ -182,6 +183,7 @@ Class | Method | HTTP request | Description - [PercolateRequestQuery](docs/PercolateRequestQuery.md) - [QueryFilter](docs/QueryFilter.md) - [RangeFilter](docs/RangeFilter.md) + - [ReplaceDocumentRequest](docs/ReplaceDocumentRequest.md) - [SearchRequest](docs/SearchRequest.md) - [SearchRequestKnn](docs/SearchRequestKnn.md) - [SearchResponse](docs/SearchResponse.md) diff --git a/docs/ReplaceDocumentRequest.md b/docs/ReplaceDocumentRequest.md new file mode 100644 index 0000000..b85ae22 --- /dev/null +++ b/docs/ReplaceDocumentRequest.md @@ -0,0 +1,16 @@ + + +# ReplaceDocumentRequest + +Object with document data. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**doc** | **Map<String, Object>** | Object with document data | | + + + + + diff --git a/pom.xml b/pom.xml index 267fb18..83a4bcf 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ manticoresearch-dev jar manticoresearch-dev - 5.0.1 + 5.1.1 https://github.com/manticoresoftware/manticoresearch-java Client for Manticore Search diff --git a/src/main/java/com/manticoresearch/client/api/IndexApi.java b/src/main/java/com/manticoresearch/client/api/IndexApi.java index 9fdfa95..4b13785 100644 --- a/src/main/java/com/manticoresearch/client/api/IndexApi.java +++ b/src/main/java/com/manticoresearch/client/api/IndexApi.java @@ -8,11 +8,13 @@ import jakarta.ws.rs.core.GenericType; +import java.math.BigDecimal; import com.manticoresearch.client.model.BulkResponse; import com.manticoresearch.client.model.DeleteDocumentRequest; import com.manticoresearch.client.model.DeleteResponse; import com.manticoresearch.client.model.ErrorResponse; import com.manticoresearch.client.model.InsertDocumentRequest; +import com.manticoresearch.client.model.ReplaceDocumentRequest; import com.manticoresearch.client.model.SuccessResponse; import com.manticoresearch.client.model.UpdateDocumentRequest; import com.manticoresearch.client.model.UpdateResponse; @@ -293,4 +295,68 @@ public ApiResponse updateWithHttpInfo(UpdateDocumentRequest upda new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, null, localVarReturnType, false); } + + /** + * Partially replaces a document in an index + * Partially replaces a document with given id in an index Responds with an object of the following format: ``` {'_index':'products','updated':1} ``` + * @param index Name of the percolate index (required) + * @param id Id of the document to replace (required) + * @param replaceDocumentRequest (required) + * @return UpdateResponse + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 item updated -
0 error -
+ * + * @see Partially replaces a document in an index Documentation + */ + public UpdateResponse update_0(String index, BigDecimal id, ReplaceDocumentRequest replaceDocumentRequest) throws ApiException { + return update_0WithHttpInfo(index, id, replaceDocumentRequest).getData(); + } + + /** + * Partially replaces a document in an index + * Partially replaces a document with given id in an index Responds with an object of the following format: ``` {'_index':'products','updated':1} ``` + * @param index Name of the percolate index (required) + * @param id Id of the document to replace (required) + * @param replaceDocumentRequest (required) + * @return ApiResponse<UpdateResponse> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 item updated -
0 error -
+ * + * @see Partially replaces a document in an index Documentation + */ + public ApiResponse update_0WithHttpInfo(String index, BigDecimal id, ReplaceDocumentRequest replaceDocumentRequest) throws ApiException { + Object localVarPostBody = replaceDocumentRequest; + // Check required parameters + if (index == null) { + throw new ApiException(400, "Missing the required parameter 'index' when calling update_0"); + } + if (id == null) { + throw new ApiException(400, "Missing the required parameter 'id' when calling update_0"); + } + if (replaceDocumentRequest == null) { + throw new ApiException(400, "Missing the required parameter 'replaceDocumentRequest' when calling update_0"); + } + + // Path parameters + String localVarPath = "/{index}/_update/{id}" + .replaceAll("\\{index}", apiClient.escapeString(index)) + .replaceAll("\\{id}", apiClient.escapeString(id.toString())); + + String localVarAccept = apiClient.selectHeaderAccept("application/json"); + String localVarContentType = apiClient.selectHeaderContentType("application/json"); + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI("IndexApi.update_0", localVarPath, "POST", new ArrayList<>(), localVarPostBody, + new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, + null, localVarReturnType, false); + } } diff --git a/src/main/java/com/manticoresearch/client/model/ReplaceDocumentRequest.java b/src/main/java/com/manticoresearch/client/model/ReplaceDocumentRequest.java new file mode 100644 index 0000000..f774495 --- /dev/null +++ b/src/main/java/com/manticoresearch/client/model/ReplaceDocumentRequest.java @@ -0,0 +1,122 @@ +/* + * Manticore Search Client + * Сlient for Manticore Search. + * + * The version of the OpenAPI document: 3.3.1 + * Contact: info@manticoresearch.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.manticoresearch.client.model; + +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.manticoresearch.client.JSON; + + +/** + * Object with document data. + */ +@JsonPropertyOrder({ + ReplaceDocumentRequest.JSON_PROPERTY_DOC +}) +@JsonTypeName("replaceDocumentRequest") +@JsonIgnoreProperties(ignoreUnknown = true) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-03-07T07:34:08.520168146Z[Etc/UTC]") +public class ReplaceDocumentRequest { + public static final String JSON_PROPERTY_DOC = "doc"; + private Map doc = new HashMap<>(); + + public ReplaceDocumentRequest() { + } + + public ReplaceDocumentRequest doc(Map doc) { + this.doc = doc; + return this; + } + + public ReplaceDocumentRequest putDocItem(String key, Object docItem) { + if (this.doc == null) { + this.doc = new HashMap<>(); + } + this.doc.put(key, docItem); + return this; + } + + /** + * Object with document data + * @return doc + **/ + @jakarta.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_DOC) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.ALWAYS) + + public Map getDoc() { + return doc; + } + + + @JsonProperty(JSON_PROPERTY_DOC) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.ALWAYS) + public void setDoc(Map doc) { + this.doc = doc; + } + + + /** + * Return true if this replaceDocumentRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReplaceDocumentRequest replaceDocumentRequest = (ReplaceDocumentRequest) o; + return Objects.equals(this.doc, replaceDocumentRequest.doc); + } + + @Override + public int hashCode() { + return Objects.hash(doc); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReplaceDocumentRequest {\n"); + sb.append(" doc: ").append(toIndentedString(doc)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} +