Add SchemaManager::waitForSearchIndexes()#2830
Merged
GromNaN merged 1 commit intodoctrine:2.13.xfrom Sep 30, 2025
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This method waits until all search indexes for specified (or all) document classes are both queryable and have indexed all documents in their corresponding collections.
$classNames, optional), a maximum wait time in milliseconds ($maxTimeMs, default 10,000 ms), and a delay between checks in milliseconds ($waitTimeMs, default 100 ms).For queryable indexes, it further verifies if all documents have been indexed by comparing the count of indexed documents with the total collection count, using aggregation pipelines appropriate for either(removed because unreliable)'search'or'vectorSearch'index types.$waitTimeMsbefore checking again, until either all indexes are ready or the maximum wait time ($maxTimeMs) is exceeded (in which case an exception is thrown).This addition provides a mechanism for applications to block until search indexes are fully prepared for querying, ensuring consistency and readiness before proceeding with operations that depend on those indexes.
Similar implementation: https://github.com/mongodb-labs/pymongo-search-utils/blob/dddd51f6e1784caa43e0dc66ec8d9487e0762d58/pymongo_search_utils/index.py#L259-L298