Remove TODO in IndexNameExpressionResolver (#52969)
This commit removes a TODO in the IndexNameExpressionResolver that indicated the API should use a Set instead of a List. However, this TODO was not completely correct since the ordering of arguments matters due to negations when evaluating wildcards and since we also allow a list of patterns like `*,-foo,*`, which would have a different meaning even when using a Set with insertion ordering. Relates #52788 Backport of #52963
This commit is contained in:
parent
39de995740
commit
1cd0eee723
|
@ -684,8 +684,6 @@ public class IndexNameExpressionResolver {
|
||||||
return resolveEmptyOrTrivialWildcard(options, metaData);
|
return resolveEmptyOrTrivialWildcard(options, metaData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Fix API to work with sets rather than lists since we need to convert to sets
|
|
||||||
// internally anyway.
|
|
||||||
Set<String> result = innerResolve(context, expressions, options, metaData);
|
Set<String> result = innerResolve(context, expressions, options, metaData);
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
|
|
|
@ -351,6 +351,10 @@ public class IndexNameExpressionResolverTests extends ESTestCase {
|
||||||
assertEquals(1, results.length);
|
assertEquals(1, results.length);
|
||||||
assertEquals("bar", results[0]);
|
assertEquals("bar", results[0]);
|
||||||
|
|
||||||
|
results = indexNameExpressionResolver.concreteIndexNames(context, "*", "-foo", "*");
|
||||||
|
assertEquals(3, results.length);
|
||||||
|
assertThat(results, arrayContainingInAnyOrder("bar", "foobar", "foo"));
|
||||||
|
|
||||||
results = indexNameExpressionResolver.concreteIndexNames(context, "-*");
|
results = indexNameExpressionResolver.concreteIndexNames(context, "-*");
|
||||||
assertEquals(0, results.length);
|
assertEquals(0, results.length);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue