Skip to content

Commit

Permalink
Azure Search Documents 11.8.0-beta.4 with bug fix (#43061)
Browse files Browse the repository at this point in the history
* Fixing bugs with an additional beta release.

* Fixing bugs with an additional beta release.

* Fixing bugs with an additional beta release.

* Fixing bugs with an additional beta release.

* Fixing bugs with an additional beta release.
  • Loading branch information
jairmyree authored Nov 22, 2024
1 parent afc791b commit 285493a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sdk/search/azure-search-documents/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Release History

## 11.8.0-beta.4 (2024-11-21)
## 11.8.0-beta.4 (2024-11-22)

### Bugs Fixed

- Fixed bug in the serialization of `SearchDocumentsResult` `debuginfo` property.
- Fixed missing properties bug in `SemanticSearchResults`.
- Added missing properties `debugInfo` and `semanticQueryRewritesResultType`.

## 11.8.0-beta.3 (2024-11-20)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public final class SemanticSearchResults {
private final List<QueryAnswerResult> queryAnswers;
private final SemanticErrorReason errorReason;
private final SemanticSearchResultsType resultsType;
private final SemanticQueryRewritesResultType semanticQueryRewritesResultType;

static {
SemanticSearchResultsAccessHelper.setAccessor(SemanticSearchResults::new);
Expand All @@ -24,6 +25,8 @@ private SemanticSearchResults(SearchPagedResponse pagedResponse) {
this.queryAnswers = SearchPagedResponseAccessHelper.getQueryAnswers(pagedResponse);
this.errorReason = SearchPagedResponseAccessHelper.getSemanticErrorReason(pagedResponse);
this.resultsType = SearchPagedResponseAccessHelper.getSemanticSearchResultsType(pagedResponse);
this.semanticQueryRewritesResultType
= SearchPagedResponseAccessHelper.getSemanticQueryRewritesResultType(pagedResponse);
}

/**
Expand Down Expand Up @@ -54,4 +57,13 @@ public SemanticErrorReason getErrorReason() {
public SemanticSearchResultsType getResultsType() {
return this.resultsType;
}

/**
* Type of query rewrite that was used for this request.
*
* @return The type of query rewrite that was used for this request.
*/
public SemanticQueryRewritesResultType getSemanticQueryRewritesResultType() {
return this.semanticQueryRewritesResultType;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.azure.search.documents.implementation.models.SearchFirstPageResponseWrapper;
import com.azure.search.documents.implementation.models.SearchRequest;
import com.azure.search.documents.implementation.util.SemanticSearchResultsAccessHelper;
import com.azure.search.documents.models.DebugInfo;
import com.azure.search.documents.models.FacetResult;
import com.azure.search.documents.models.SearchResult;
import com.azure.search.documents.models.SemanticSearchResults;
Expand Down Expand Up @@ -112,4 +113,18 @@ public Mono<SemanticSearchResults> getSemanticResults() {
return metadataSupplier.get()
.map(metadata -> SemanticSearchResultsAccessHelper.create(metadata.getFirstPageResponse()));
}

/**
* The debug information that can be used to further explore your search results.
*
* @return The debug information that can be used to further explore your search results.
*/
public Mono<DebugInfo> getDebugInfo() {
return metadataSupplier.get().flatMap(metaData -> {
if (metaData.getFirstPageResponse().getDebugInfo() == null) {
return Mono.empty();
}
return Mono.just(metaData.getFirstPageResponse().getDebugInfo());
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.azure.search.documents.implementation.models.SearchFirstPageResponseWrapper;
import com.azure.search.documents.implementation.models.SearchRequest;
import com.azure.search.documents.implementation.util.SemanticSearchResultsAccessHelper;
import com.azure.search.documents.models.DebugInfo;
import com.azure.search.documents.models.FacetResult;
import com.azure.search.documents.models.SearchResult;
import com.azure.search.documents.models.SemanticSearchResults;
Expand Down Expand Up @@ -132,4 +133,15 @@ public SemanticSearchResults getSemanticResults() {
? SemanticSearchResultsAccessHelper.create(metadataSupplier.get().getFirstPageResponse())
: pagedFlux.getSemanticResults().block();
}

/**
* The debug information that can be used to further explore your search results.
*
* @return The debug information that can be used to further explore your search results.
*/
public DebugInfo getDebugInfo() {
return metadataSupplier != null
? metadataSupplier.get().getFirstPageResponse().getDebugInfo()
: pagedFlux.getDebugInfo().block();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ public static void semanticSearch(SearchClient searchClient) {

SemanticSearchResults semanticSearchResults = results.getSemanticResults();

System.out.println("Semantic Query Rewrites Result Type: " + semanticSearchResults.getSemanticQueryRewritesResultType());



System.out.println("Semantic Results Type: " + semanticSearchResults.getResultsType());

if (semanticSearchResults.getErrorReason() != null) {
Expand Down

0 comments on commit 285493a

Please sign in to comment.