Refactor search to get rid of dependency on static api_client
instance
#468
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.
Searching currently relies on the static instance of
api_client
which is initialised atClient
load-time to interface with the database and retrieve metadata.This instance is deprecated and due for removal, so we need to fix this behaviour. Search should only ever use the
Client
instance it was called with, so we need to either inject the dependency down or refactor the behaviour so it can directly access theClient
.As part of this, we move factory methods out of
SearchResultMetadata
andSearchResult
, which provides a cleaner separation of concerns and reduces the depth to which we need to make changes to account for removingapi_client
.There should be no functional changes as a result of this PR, and it should be non-breaking for EUI and PUI.