Skip to content

Commit b808311

Browse files
committed
improve
1 parent 07d8dc7 commit b808311

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

libs/x-content/src/main/java/org/elasticsearch/xcontent/support/filtering/FilterPath.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ public class FilterPath {
2424
private final Map<String, FilterPath> termsChildren;
2525
private final List<FilterPath> wildcardChildren;
2626
private final String pattern;
27-
private final boolean doubleWildcard;
27+
private final boolean isDoubleWildcard;
2828
private final boolean isFinalNode;
2929
private boolean hasDoubleWildcard;
3030

3131
private FilterPath(
3232
String pattern,
33-
boolean doubleWildcard,
33+
boolean isDoubleWildcard,
3434
boolean isFinalNode,
3535
boolean hasDoubleWildcard,
3636
Map<String, FilterPath> termsChildren,
3737
List<FilterPath> wildcardChildren
3838
) {
3939
this.pattern = pattern;
40-
this.doubleWildcard = doubleWildcard;
40+
this.isDoubleWildcard = isDoubleWildcard;
4141
this.isFinalNode = isFinalNode;
4242
this.hasDoubleWildcard = hasDoubleWildcard;
4343
this.termsChildren = termsChildren;
@@ -91,7 +91,7 @@ boolean matches(String name, List<FilterPath> nextFilters) {
9191
}
9292
}
9393

94-
if (doubleWildcard) {
94+
if (isDoubleWildcard) {
9595
nextFilters.add(this);
9696
}
9797

libs/x-content/src/test/java/org/elasticsearch/xcontent/support/filtering/FilterPathGeneratorFilteringTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public void testInclusiveFilters() throws Exception {
7171

7272
assertResult(SAMPLE, "h.i.j.k.l,h.i.j.k.l.m", true, "{'h':{'i':{'j':{'k':{'l':'l_value'}}}}}");
7373
assertResult(SAMPLE, "a,b,c,d,e.f1,e.f2,e.g1,e.g2,h.i.j.k.l", true, SAMPLE);
74+
assertResult(SAMPLE, "", true, "");
75+
assertResult(SAMPLE, "h.", true, "");
7476
}
7577

7678
public void testExclusiveFilters() throws Exception {
@@ -157,6 +159,8 @@ public void testExclusiveFilters() throws Exception {
157159
);
158160

159161
assertResult(SAMPLE, "a,b,c,d,e.f1,e.f2,e.g1,e.g2,h.i.j.k.l", false, "");
162+
assertResult(SAMPLE, "", false, SAMPLE);
163+
assertResult(SAMPLE, "h.", false, SAMPLE);
160164
}
161165

162166
public void testInclusiveFiltersWithDots() throws Exception {

0 commit comments

Comments
 (0)