Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
import com.azure.search.documents.implementation.SearchClientImpl;
import com.azure.search.documents.implementation.SearchUtils;
import com.azure.search.documents.implementation.models.AutocompletePostRequest;
import com.azure.search.documents.implementation.models.CountRequestAccept6;
import com.azure.search.documents.implementation.models.SuggestPostRequest;
import com.azure.search.documents.models.AutocompleteOptions;
import com.azure.search.documents.models.AutocompleteResult;
import com.azure.search.documents.models.CountRequestAccept;
import com.azure.search.documents.models.CountRequestAccept3;
import com.azure.search.documents.models.IndexBatchException;
import com.azure.search.documents.models.IndexDocumentsBatch;
import com.azure.search.documents.models.IndexDocumentsOptions;
Expand Down Expand Up @@ -99,6 +102,14 @@ public SearchServiceVersion getServiceVersion() {

/**
* Sends a batch of document write actions to the index.
* <p><strong>Header Parameters</strong></p>
* <table border="1">
* <caption>Header Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>Accept</td><td>String</td><td>No</td><td>The Accept header. Allowed values:
* "application/json;odata.metadata=none".</td></tr>
* </table>
* You can add these to a request with {@link RequestOptions#addHeader}
* <p><strong>Request Body Schema</strong></p>
*
* <pre>
Expand Down Expand Up @@ -164,7 +175,7 @@ public Mono<Long> getDocumentCount() {
// Generated convenience method for hiddenGeneratedGetDocumentCountWithResponse
RequestOptions requestOptions = new RequestOptions();
return hiddenGeneratedGetDocumentCountWithResponse(requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(Long.class));
.map(protocolMethodData -> Long.parseLong(protocolMethodData.toString()));
}

/**
Expand Down Expand Up @@ -237,49 +248,6 @@ public SearchPagedFlux search(SearchOptions options, RequestOptions requestOptio
});
}

/**
* Retrieves a document from the index.
*
* @param key The key of the document to retrieve.
* @param querySourceAuthorization Token identifying the user for which the query is being executed. This token is
* used to enforce security restrictions on documents.
* @param enableElevatedRead A value that enables elevated read that bypass document level permission checks for the
* query operation.
* @param selectedFields List of field names to retrieve for the document; Any field not retrieved will be missing
* from the returned document.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a document retrieved via a document lookup operation on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<LookupDocument> getDocument(String key, String querySourceAuthorization, Boolean enableElevatedRead,
List<String> selectedFields) {
// Generated convenience method for hiddenGeneratedGetDocumentWithResponse
RequestOptions requestOptions = new RequestOptions();
if (querySourceAuthorization != null) {
requestOptions.setHeader(HttpHeaderName.fromString("x-ms-query-source-authorization"),
querySourceAuthorization);
}
if (enableElevatedRead != null) {
requestOptions.setHeader(HttpHeaderName.fromString("x-ms-enable-elevated-read"),
String.valueOf(enableElevatedRead));
}
if (selectedFields != null) {
requestOptions.addQueryParam("$select",
selectedFields.stream()
.map(paramItemValue -> Objects.toString(paramItemValue, ""))
.collect(Collectors.joining(",")),
false);
}
return hiddenGeneratedGetDocumentWithResponse(key, requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(LookupDocument.class));
}

/**
* Retrieves a document from the index.
*
Expand Down Expand Up @@ -384,6 +352,8 @@ public Mono<Response<IndexDocumentsResult>> indexDocumentsWithResponse(IndexDocu
* <table border="1">
* <caption>Header Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>Accept</td><td>String</td><td>No</td><td>The Accept header. Allowed values:
* "application/json;odata.metadata=none".</td></tr>
* <tr><td>x-ms-query-source-authorization</td><td>String</td><td>No</td><td>Token identifying the user for which
* the query is being executed. This token is used to enforce security restrictions on documents.</td></tr>
* <tr><td>x-ms-enable-elevated-read</td><td>Boolean</td><td>No</td><td>A value that enables elevated read that
Expand Down Expand Up @@ -676,6 +646,14 @@ Mono<Response<BinaryData>> searchWithResponse(BinaryData searchPostRequest, Requ

/**
* Suggests documents in the index that match the given partial query text.
* <p><strong>Header Parameters</strong></p>
* <table border="1">
* <caption>Header Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>Accept</td><td>String</td><td>No</td><td>The Accept header. Allowed values:
* "application/json;odata.metadata=none".</td></tr>
* </table>
* You can add these to a request with {@link RequestOptions#addHeader}
* <p><strong>Request Body Schema</strong></p>
*
* <pre>
Expand Down Expand Up @@ -737,6 +715,14 @@ Mono<Response<BinaryData>> suggestWithResponse(BinaryData suggestPostRequest, Re

/**
* Autocompletes incomplete query terms based on input text and matching terms in the index.
* <p><strong>Header Parameters</strong></p>
* <table border="1">
* <caption>Header Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>Accept</td><td>String</td><td>No</td><td>The Accept header. Allowed values:
* "application/json;odata.metadata=none".</td></tr>
* </table>
* You can add these to a request with {@link RequestOptions#addHeader}
* <p><strong>Request Body Schema</strong></p>
*
* <pre>
Expand Down Expand Up @@ -968,6 +954,14 @@ public Mono<Response<LookupDocument>> getDocumentWithResponse(String key, Reques

/**
* Queries the number of documents in the index.
* <p><strong>Header Parameters</strong></p>
* <table border="1">
* <caption>Header Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>Accept</td><td>String</td><td>No</td><td>The Accept header. Allowed values:
* "application/json;odata.metadata=none".</td></tr>
* </table>
* You can add these to a request with {@link RequestOptions#addHeader}
* <p><strong>Response Body Schema</strong></p>
*
* <pre>
Expand Down Expand Up @@ -1004,6 +998,8 @@ Mono<Response<BinaryData>> hiddenGeneratedGetDocumentCountWithResponse(RequestOp
* <table border="1">
* <caption>Header Parameters</caption>
* <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
* <tr><td>Accept</td><td>String</td><td>No</td><td>The Accept header. Allowed values:
* "application/json;odata.metadata=none".</td></tr>
* <tr><td>x-ms-query-source-authorization</td><td>String</td><td>No</td><td>Token identifying the user for which
* the query is being executed. This token is used to enforce security restrictions on documents.</td></tr>
* <tr><td>x-ms-enable-elevated-read</td><td>Boolean</td><td>No</td><td>A value that enables elevated read that
Expand Down Expand Up @@ -1036,4 +1032,101 @@ Mono<Response<BinaryData>> hiddenGeneratedGetDocumentCountWithResponse(RequestOp
Mono<Response<BinaryData>> hiddenGeneratedGetDocumentWithResponse(String key, RequestOptions requestOptions) {
return this.serviceClient.getDocumentWithResponseAsync(key, requestOptions);
}

/**
* Queries the number of documents in the index.
*
* @param accept The Accept header.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a 64-bit integer on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Long> getDocumentCount(CountRequestAccept accept) {
// Generated convenience method for hiddenGeneratedGetDocumentCountWithResponse
RequestOptions requestOptions = new RequestOptions();
if (accept != null) {
requestOptions.setHeader(HttpHeaderName.ACCEPT, accept.toString());
}
return hiddenGeneratedGetDocumentCountWithResponse(requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> Long.parseLong(protocolMethodData.toString()));
}

/**
* Retrieves a document from the index.
*
* @param key The key of the document to retrieve.
* @param accept The Accept header.
* @param querySourceAuthorization Token identifying the user for which the query is being executed. This token is
* used to enforce security restrictions on documents.
* @param enableElevatedRead A value that enables elevated read that bypass document level permission checks for the
* query operation.
* @param selectedFields List of field names to retrieve for the document; Any field not retrieved will be missing
* from the returned document.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a document retrieved via a document lookup operation on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<LookupDocument> getDocument(String key, CountRequestAccept3 accept, String querySourceAuthorization,
Boolean enableElevatedRead, List<String> selectedFields) {
// Generated convenience method for hiddenGeneratedGetDocumentWithResponse
RequestOptions requestOptions = new RequestOptions();
if (accept != null) {
requestOptions.setHeader(HttpHeaderName.ACCEPT, accept.toString());
}
if (querySourceAuthorization != null) {
requestOptions.setHeader(HttpHeaderName.fromString("x-ms-query-source-authorization"),
querySourceAuthorization);
}
if (enableElevatedRead != null) {
requestOptions.setHeader(HttpHeaderName.fromString("x-ms-enable-elevated-read"),
String.valueOf(enableElevatedRead));
}
if (selectedFields != null) {
requestOptions.addQueryParam("$select",
selectedFields.stream()
.map(paramItemValue -> Objects.toString(paramItemValue, ""))
.collect(Collectors.joining(",")),
false);
}
return hiddenGeneratedGetDocumentWithResponse(key, requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(LookupDocument.class));
}

/**
* Sends a batch of document write actions to the index.
*
* @param batch The batch of index actions.
* @param accept The Accept header.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return response containing the status of operations for all documents in the indexing request on successful
* completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<IndexDocumentsResult> index(IndexDocumentsBatch batch, CountRequestAccept6 accept) {
// Generated convenience method for indexWithResponse
RequestOptions requestOptions = new RequestOptions();
if (accept != null) {
requestOptions.setHeader(HttpHeaderName.ACCEPT, accept.toString());
}
return indexWithResponse(BinaryData.fromObject(batch), requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(IndexDocumentsResult.class));
}
}
Loading
Loading