Skip to content

Conversation

alzimmermsft
Copy link
Member

Description

Fixes #43095

Removes the logic where SearchClient and SearchAsyncClient will return the same first page for every subsequent iteration / subscription on the SearchPagedIterable and SearchPagedFlux returned.

All non-iterating / subscription APIs on SearchPagedIterable and SearchPagedFlux have been deprecated and the equivalent APIs in SearchPagedResponse should be used.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@alzimmermsft alzimmermsft self-assigned this Oct 13, 2025
@Copilot Copilot AI review requested due to automatic review settings October 13, 2025 21:28
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where SearchPagedFlux and SearchPagedIterable would return the same first page for every subsequent iteration/subscription. The fix removes logic that was caching the first page response and deprecates non-iterating APIs on these classes in favor of using equivalent APIs on SearchPagedResponse.

Key Changes

  • Removed caching logic from search clients that caused duplicate first page results
  • Made SearchPagedResponse methods public and deprecated equivalent methods on pageable types
  • Consolidated search response creation into a shared utility method

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
SearchClient.java Removed first page caching logic and consolidated response creation
SearchAsyncClient.java Removed first page caching logic and added shared response mapping utility
SearchPagedResponse.java Made accessor methods public and updated constructors with deprecations
SearchPagedIterable.java Deprecated metadata access methods with guidance to use response methods
SearchPagedFlux.java Deprecated metadata access methods with guidance to use response methods
SemanticSearchResults.java Updated constructor to accept parameters directly instead of SearchPagedResponse
Test files Updated to use new public methods instead of helper classes
Helper classes Removed SearchPagedResponseAccessHelper and updated SemanticSearchResultsAccessHelper

* @param facets Facets contained in the search.
* @param count Total number of documents available as a result for the search.
* @param coverage Percent of the index used in the search operation.
* @deprecated Use {@link SearchPagedResponse#SearchPagedResponse(Response, String, Map, Long, Double, List, SemanticErrorReason, SemanticSearchResultsType, DebugInfo, SemanticQueryRewritesResultType)}
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deprecated constructor reference is incorrect. The actual constructor being referenced has different parameter ordering and types. Should reference the correct constructor signature with SemanticSearchResults parameter.

Copilot uses AI. Check for mistakes.

* @param queryAnswers Answers contained in the search.
* @param semanticErrorReason Reason that a partial response was returned for a semantic search request.
* @param semanticSearchResultsType Type of the partial response returned for a semantic search request.
* @deprecated Use {@link SearchPagedResponse#SearchPagedResponse(Response, String, Map, Long, Double, List, SemanticErrorReason, SemanticSearchResultsType, DebugInfo, SemanticQueryRewritesResultType)}
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deprecated constructor reference is incorrect. The actual constructor being referenced has different parameter ordering and types. Should reference the correct constructor signature with SemanticSearchResults parameter.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

API Change Check

APIView identified API level changes in this PR and created the following API reviews

com.azure:azure-search-documents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Incorrect behavior for SearchAsyncClient.search() with multiple subscribers

1 participant