Add explicit throw methods for getting index state and fields #762
+449
−297
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.
IndexState.getField(name)
,GlobalState.getIndex(name)
, andGlobalState.getIndexStateManager(name)
all throw anIllegalArgumentException
if the index/field does not exist. This makes it harder to handles cases where something not existing is acceptable.I modified these methods to return
null
instead of throwing an exception. Separate methods have been added (*OrThrow()
) that preserve the status quo behavior. Almost all existing usage of these methods has been change to use the throwing version. TheDocLookup
in theIndexState
uses the non-throwing version, as this provides consistent behavior with the lookup created during search request processing.None of the currently ported plugins use this api, so they should still be compatible.
The example-plugin test is expected to fail until it gets updated for the alpha.2 release.