Skip to content

Commit 016c6ea

Browse files
committed
do not add root search if only wildcard is specified
1 parent fd017be commit 016c6ea

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

services/alarm-logger/src/main/java/org/phoebus/alarm/logging/rest/AlarmLogSearchUtil.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,25 @@ public static List<AlarmLogMessage> search(ElasticsearchClient client,
139139
configSet = true;
140140
break;
141141
case ROOT:
142-
boolQuery.must(
143-
Query.of(b -> b.bool(s -> s.should(
144-
Query.of(q -> q
145-
.wildcard(WildcardQuery.of(w -> w
146-
.field("config").value("state:/" + parameter.getValue().strip() + "*")
147-
)
148-
)
149-
),
150-
Query.of(q -> q
151-
.wildcard(WildcardQuery.of(w -> w
152-
.field("config").value("config:/" + parameter.getValue().strip() + "*")
153-
)
154-
)
155-
)
156-
)))
157-
);
158-
configSet = true;
142+
if (!parameter.getValue().equalsIgnoreCase("*")) {
143+
boolQuery.must(
144+
Query.of(b -> b.bool(s -> s.should(
145+
Query.of(q -> q
146+
.wildcard(WildcardQuery.of(w -> w
147+
.field("config").value("state:/" + parameter.getValue().strip() + "*")
148+
)
149+
)
150+
),
151+
Query.of(q -> q
152+
.wildcard(WildcardQuery.of(w -> w
153+
.field("config").value("config:/" + parameter.getValue().strip() + "*")
154+
)
155+
)
156+
)
157+
)))
158+
);
159+
configSet = true;
160+
}
159161
break;
160162
case SEVERITY:
161163
if (!parameter.getValue().equalsIgnoreCase("*"))

0 commit comments

Comments
 (0)