Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare azure-search-documents for June 2021 GA Release #21909

Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import com.azure.search.documents.models.IndexBatchException;
import com.azure.search.documents.models.IndexDocumentsOptions;
import com.azure.search.documents.models.IndexDocumentsResult;
import com.azure.search.documents.models.QueryAnswer;
import com.azure.search.documents.models.ScoringParameter;
import com.azure.search.documents.models.SearchOptions;
import com.azure.search.documents.models.SearchResult;
Expand Down Expand Up @@ -654,7 +653,7 @@ private Mono<SearchPagedResponse> search(SearchRequest request, String continuat
SearchPagedResponse page = new SearchPagedResponse(
new SimpleResponse<>(response, getSearchResults(result)),
createContinuationToken(result, serviceVersion), getFacets(result), result.getCount(),
result.getCoverage(), result.getAnswers());
result.getCoverage());
if (continuationToken == null) {
firstPageResponseWrapper.setFirstPageResponse(page);
}
Expand Down Expand Up @@ -833,9 +832,6 @@ private static SearchRequest createSearchRequest(String searchText, SearchOption
.setScoringParameters(scoringParameters)
.setScoringProfile(options.getScoringProfile())
.setSearchFields(nullSafeStringJoin(options.getSearchFields()))
.setQueryLanguage(options.getQueryLanguage())
.setSpeller(options.getSpeller())
.setAnswers(createSearchRequestAnswers(options))
.setSearchMode(options.getSearchMode())
.setScoringStatistics(options.getScoringStatistics())
.setSessionId(options.getSessionId())
Expand All @@ -844,24 +840,6 @@ private static SearchRequest createSearchRequest(String searchText, SearchOption
.setTop(options.getTop());
}

private static String createSearchRequestAnswers(SearchOptions searchOptions) {
QueryAnswer answer = searchOptions.getAnswers();
Integer answersCount = searchOptions.getAnswersCount();

// No answer has been defined.
if (answer == null) {
return null;
}

// No count, just send the QueryAnswer.
if (answersCount == null) {
return answer.toString();
}

// Answer and count, format it as the service expects.
return String.format("%s|count-%d", answer, answersCount);
}

/**
* Create suggest request from search text, suggester name, and parameters
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
* The versions of Azure Cognitive Search supported by this client library.
*/
public enum SearchServiceVersion implements ServiceVersion {
V2020_06_30("2020-06-30"),
V2020_06_30_PREVIEW("2020-06-30-Preview");
V2020_06_30("2020-06-30");

private final String version;

Expand All @@ -32,6 +31,6 @@ public String getVersion() {
* @return The latest version supported by this client library.
*/
public static SearchServiceVersion getLatest() {
return V2020_06_30_PREVIEW;
return V2020_06_30;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
import com.azure.search.documents.models.AutocompleteMode;
import com.azure.search.documents.models.AutocompleteOptions;
import com.azure.search.documents.models.AutocompleteResult;
import com.azure.search.documents.models.QueryLanguage;
import com.azure.search.documents.models.QuerySpeller;
import com.azure.search.documents.models.QueryType;
import com.azure.search.documents.models.ScoringStatistics;
import com.azure.search.documents.models.SearchMode;
Expand Down Expand Up @@ -103,9 +101,6 @@ Mono<Response<SearchDocumentsResult>> searchGet(
@QueryParam("scoringParameter") String scoringParameters,
@QueryParam("scoringProfile") String scoringProfile,
@QueryParam("searchFields") String searchFields,
@QueryParam("queryLanguage") QueryLanguage queryLanguage,
@QueryParam("speller") QuerySpeller speller,
@QueryParam("answers") String answers,
@QueryParam("searchMode") SearchMode searchMode,
@QueryParam("scoringStatistics") ScoringStatistics scoringStatistics,
@QueryParam("sessionId") String sessionId,
Expand Down Expand Up @@ -325,21 +320,6 @@ public Mono<Response<SearchDocumentsResult>> searchGetWithResponseAsync(
searchFieldsInternal = searchOptions.getSearchFields();
}
List<String> searchFields = searchFieldsInternal;
QueryLanguage queryLanguageInternal = null;
if (searchOptions != null) {
queryLanguageInternal = searchOptions.getQueryLanguage();
}
QueryLanguage queryLanguage = queryLanguageInternal;
QuerySpeller spellerInternal = null;
if (searchOptions != null) {
spellerInternal = searchOptions.getSpeller();
}
QuerySpeller speller = spellerInternal;
String answersInternal = null;
if (searchOptions != null) {
answersInternal = searchOptions.getAnswers();
}
String answers = answersInternal;
SearchMode searchModeInternal = null;
if (searchOptions != null) {
searchModeInternal = searchOptions.getSearchMode();
Expand Down Expand Up @@ -403,9 +383,6 @@ public Mono<Response<SearchDocumentsResult>> searchGetWithResponseAsync(
scoringParametersConverted,
scoringProfile,
searchFieldsConverted,
queryLanguage,
speller,
answers,
searchMode,
scoringStatistics,
sessionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public SearchIndexClientImplBuilder addPolicy(HttpPipelinePolicy customPolicy) {
*/
public SearchIndexClientImpl buildClient() {
if (apiVersion == null) {
this.apiVersion = "2020-06-30-Preview";
this.apiVersion = "2020-06-30";
}
if (pipeline == null) {
this.pipeline = createHttpPipeline();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public static SearchIndex map(com.azure.search.documents.indexes.implementation.

searchIndex.setSuggesters(obj.getSuggesters());
searchIndex.setCharFilters(obj.getCharFilters());
searchIndex.setNormalizers(obj.getNormalizers());

if (obj.getTokenFilters() != null) {
List<TokenFilter> tokenFilters =
Expand Down Expand Up @@ -74,7 +73,6 @@ public static com.azure.search.documents.indexes.implementation.models.SearchInd

searchIndex.setSuggesters(obj.getSuggesters());
searchIndex.setCharFilters(obj.getCharFilters());
searchIndex.setNormalizers(obj.getNormalizers());

if (obj.getTokenFilters() != null) {
List<com.azure.search.documents.indexes.implementation.models.TokenFilter> tokenFilters =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ public static SearchResult map(com.azure.search.documents.implementation.models.

SearchResult searchResult = new SearchResult(obj.getScore());

SearchResultHelper.setRerankerScore(searchResult, obj.getRerankerScore());
SearchResultHelper.setHighlights(searchResult, obj.getHighlights());
SearchResultHelper.setCaptions(searchResult, obj.getCaptions());
SearchResultHelper.setAdditionalProperties(searchResult, new SearchDocument(obj.getAdditionalProperties()));
SearchResultHelper.setJsonSerializer(searchResult, (JsonSerializer) serializer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import com.azure.core.util.serializer.JsonSerializer;
import com.azure.search.documents.SearchDocument;
import com.azure.search.documents.models.CaptionResult;
import com.azure.search.documents.models.SearchResult;

import java.util.List;
Expand All @@ -26,8 +25,6 @@ public interface SearchResultAccessor {
void setAdditionalProperties(SearchResult searchResult, SearchDocument additionalProperties);
void setHighlights(SearchResult searchResult, Map<String, List<String>> highlights);
void setJsonSerializer(SearchResult searchResult, JsonSerializer jsonSerializer);
void setRerankerScore(SearchResult searchResult, Double rerankerScore);
void setCaptions(SearchResult searchResult, List<CaptionResult> captions);
}

/**
Expand All @@ -50,12 +47,4 @@ static void setHighlights(SearchResult searchResult, Map<String, List<String>> h
static void setJsonSerializer(SearchResult searchResult, JsonSerializer jsonSerializer) {
accessor.setJsonSerializer(searchResult, jsonSerializer);
}

static void setRerankerScore(SearchResult searchResult, Double rerankerScore) {
accessor.setRerankerScore(searchResult, rerankerScore);
}

static void setCaptions(SearchResult searchResult, List<CaptionResult> captions) {
accessor.setCaptions(searchResult, captions);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package com.azure.search.documents.implementation.models;

import com.azure.core.annotation.Immutable;
import com.azure.search.documents.models.AnswerResult;
import com.azure.search.documents.models.FacetResult;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down Expand Up @@ -42,13 +41,6 @@ public final class SearchDocumentsResult {
@JsonProperty(value = "@search.facets", access = JsonProperty.Access.WRITE_ONLY)
private Map<String, List<FacetResult>> facets;

/*
* The answers query results for the search operation; null if the answers
* query parameter was not specified or set to 'none'.
*/
@JsonProperty(value = "@search.answers", access = JsonProperty.Access.WRITE_ONLY)
private List<AnswerResult> answers;

/*
* Continuation JSON payload returned when Azure Cognitive Search can't
* return all the requested results in a single Search response. You can
Expand Down Expand Up @@ -118,16 +110,6 @@ public Map<String, List<FacetResult>> getFacets() {
return this.facets;
}

/**
* Get the answers property: The answers query results for the search operation; null if the answers query parameter
* was not specified or set to 'none'.
*
* @return the answers value.
*/
public List<AnswerResult> getAnswers() {
return this.answers;
}

/**
* Get the nextPageParameters property: Continuation JSON payload returned when Azure Cognitive Search can't return
* all the requested results in a single Search response. You can use this JSON along with @odata.nextLink to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
package com.azure.search.documents.implementation.models;

import com.azure.core.annotation.Fluent;
import com.azure.search.documents.models.QueryLanguage;
import com.azure.search.documents.models.QuerySpeller;
import com.azure.search.documents.models.QueryType;
import com.azure.search.documents.models.ScoringStatistics;
import com.azure.search.documents.models.SearchMode;
Expand Down Expand Up @@ -117,29 +115,6 @@ public final class SearchOptions {
@JsonProperty(value = "searchFields")
private List<String> searchFields;

/*
* The language of the query.
*/
@JsonProperty(value = "queryLanguage")
private QueryLanguage queryLanguage;

/*
* Improve search recall by spell-correcting individual search query terms.
*/
@JsonProperty(value = "speller")
private QuerySpeller speller;

/*
* This parameter is only valid if the query type is 'semantic'. If set,
* the query returns answers extracted from key passages in the highest
* ranked documents. The number of answers returned can be configured by
* appending the pipe character '|' followed by the 'count-<number of
* answers>' option after the answers parameter value, such as
* 'extractive|count-3'. Default count is 1.
*/
@JsonProperty(value = "answers")
private String answers;

/*
* A value that specifies whether any or all of the search terms must be
* matched in order to count the document as a match.
Expand Down Expand Up @@ -469,72 +444,6 @@ public SearchOptions setSearchFields(String... searchFields) {
return this;
}

/**
* Get the queryLanguage property: The language of the query.
*
* @return the queryLanguage value.
*/
public QueryLanguage getQueryLanguage() {
return this.queryLanguage;
}

/**
* Set the queryLanguage property: The language of the query.
*
* @param queryLanguage the queryLanguage value to set.
* @return the SearchOptions object itself.
*/
public SearchOptions setQueryLanguage(QueryLanguage queryLanguage) {
this.queryLanguage = queryLanguage;
return this;
}

/**
* Get the speller property: Improve search recall by spell-correcting individual search query terms.
*
* @return the speller value.
*/
public QuerySpeller getSpeller() {
return this.speller;
}

/**
* Set the speller property: Improve search recall by spell-correcting individual search query terms.
*
* @param speller the speller value to set.
* @return the SearchOptions object itself.
*/
public SearchOptions setSpeller(QuerySpeller speller) {
this.speller = speller;
return this;
}

/**
* Get the answers property: This parameter is only valid if the query type is 'semantic'. If set, the query returns
* answers extracted from key passages in the highest ranked documents. The number of answers returned can be
* configured by appending the pipe character '|' followed by the 'count-&lt;number of answers&gt;' option after the
* answers parameter value, such as 'extractive|count-3'. Default count is 1.
*
* @return the answers value.
*/
public String getAnswers() {
return this.answers;
}

/**
* Set the answers property: This parameter is only valid if the query type is 'semantic'. If set, the query returns
* answers extracted from key passages in the highest ranked documents. The number of answers returned can be
* configured by appending the pipe character '|' followed by the 'count-&lt;number of answers&gt;' option after the
* answers parameter value, such as 'extractive|count-3'. Default count is 1.
*
* @param answers the answers value to set.
* @return the SearchOptions object itself.
*/
public SearchOptions setAnswers(String answers) {
this.answers = answers;
return this;
}

/**
* Get the searchMode property: A value that specifies whether any or all of the search terms must be matched in
* order to count the document as a match.
Expand Down
Loading