-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Search] Refactor service to register search strategies, not providers #60342
Conversation
x-pack/plugins/data_enhanced/public/search/async_search_strategy.ts
Outdated
Show resolved
Hide resolved
@@ -277,6 +277,7 @@ exports[`SavedObjectsTable import should show the flyout 1`] = ` | |||
"getMetrics": [Function], | |||
}, | |||
}, | |||
"getSearchStrategy": [MockFunction], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that. Will be fixed by #68489
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukasolson I'm approving to unblock merging, but I would appreciate you taking a look
elastic#60342) * Add async search strategy * Add async search * Fix async strategy and add tests * Move types to separate file * Revert changes to demo search * Update demo search strategy to use async * Add async es search strategy * Return response as rawResponse * Poll after initial request * Add cancellation to search strategies * Add tests * Simplify async search strategy * Move loadingCount to search strategy * Update abort controller library * Bootstrap * Abort when the request is aborted * Add utility and update value suggestions route * Fix bad merge conflict * Update tests * Move to data_enhanced plugin * Remove bad merge * Revert switching abort controller libraries * Revert package.json in lib * Move to previous abort controller * Add support for frozen indices * Fix test to use fake timers to run debounced handlers * Revert changes to example plugin * Fix loading bar not going away when cancelling * Call getSearchStrategy instead of passing directly * Add async demo search strategy * Fix error with setting state * Update how aborting works * Fix type checks * Add test for loading count * Attempt to fix broken example test * Revert changes to test * Fix test * Update name to camelCase * Fix failing test * Don't require data_enhanced in example plugin * Actually send DELETE request * Use waitForCompletion parameter * Use default search params * Add support for rollups * Only make changes needed for frozen indices/rollups * Only make changes needed for frozen indices/rollups * Add back in async functionality * Fix tests/types * Fix issue with sending empty body in GET * Don't include skipped in loaded/total * Don't wait before polling the next time * Add search interceptor for bulk managing searches * Simplify search logic * Fix merge error * Review feedback * UI to stop async searches * Add service for running beyond timeout * Refactor abort utils * Remove unneeded changes * Add tests * Refactor search service to register strategies directly * Remove accidental change * re-generate docs * Fix merge * types * doc * eslint * Fix async strategy jest test * type fix * Use getStartServices in search strategies * Code review + snapshot * eslint * Type script Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Liza K <liza.katz@elastic.co>
#60342) (#68545) * Add async search strategy * Add async search * Fix async strategy and add tests * Move types to separate file * Revert changes to demo search * Update demo search strategy to use async * Add async es search strategy * Return response as rawResponse * Poll after initial request * Add cancellation to search strategies * Add tests * Simplify async search strategy * Move loadingCount to search strategy * Update abort controller library * Bootstrap * Abort when the request is aborted * Add utility and update value suggestions route * Fix bad merge conflict * Update tests * Move to data_enhanced plugin * Remove bad merge * Revert switching abort controller libraries * Revert package.json in lib * Move to previous abort controller * Add support for frozen indices * Fix test to use fake timers to run debounced handlers * Revert changes to example plugin * Fix loading bar not going away when cancelling * Call getSearchStrategy instead of passing directly * Add async demo search strategy * Fix error with setting state * Update how aborting works * Fix type checks * Add test for loading count * Attempt to fix broken example test * Revert changes to test * Fix test * Update name to camelCase * Fix failing test * Don't require data_enhanced in example plugin * Actually send DELETE request * Use waitForCompletion parameter * Use default search params * Add support for rollups * Only make changes needed for frozen indices/rollups * Only make changes needed for frozen indices/rollups * Add back in async functionality * Fix tests/types * Fix issue with sending empty body in GET * Don't include skipped in loaded/total * Don't wait before polling the next time * Add search interceptor for bulk managing searches * Simplify search logic * Fix merge error * Review feedback * UI to stop async searches * Add service for running beyond timeout * Refactor abort utils * Remove unneeded changes * Add tests * Refactor search service to register strategies directly * Remove accidental change * re-generate docs * Fix merge * types * doc * eslint * Fix async strategy jest test * type fix * Use getStartServices in search strategies * Code review + snapshot * eslint * Type script Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Liza K <liza.katz@elastic.co> Co-authored-by: Lukas Olson <olson.lukas@gmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
Waiting on #60058.
This PR updates the data plugin search service API. Instead of exposing a
registerSearchStrategyProvider
function, which is called every timesearch
is called, it exposes aregisterSearchStrategy
function which is expected to return the search strategy directly.In other words, it moves the responsibility of instantiating the search strategy to plugins themselves, rather than taking care of instantiating them as part of the search service. This will be necessary in situations where a search strategy needs to do some sort of setup that persists across multiple
search
calls, or when a plugin needs to modify or provide different dependencies.Checklist
Delete any items that are not applicable to this PR.
For maintainers