Skip to content

Commit 12df171

Browse files
authored
Add allProjects method for TargetProjects (#137289)
* add allProjects method for TargetProjects
1 parent c3ee021 commit 12df171

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

server/src/main/java/org/elasticsearch/search/crossproject/TargetProjects.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,17 @@ public String originProjectAlias() {
5555

5656
public Set<String> allProjectAliases() {
5757
// TODO consider caching this
58+
return allProjects().map(ProjectRoutingInfo::projectAlias).collect(Collectors.toUnmodifiableSet());
59+
}
60+
61+
/**
62+
* Stream containing all project infos, including origin and linked projects
63+
*/
64+
public Stream<ProjectRoutingInfo> allProjects() {
5865
return Stream.concat(
5966
originProject != null ? Stream.of(originProject) : Stream.empty(),
6067
linkedProjects != null ? linkedProjects.stream() : Stream.empty()
61-
).map(ProjectRoutingInfo::projectAlias).collect(Collectors.toUnmodifiableSet());
68+
);
6269
}
6370

6471
// TODO: Either change the definition or the method name since it allows targeting only the origin project without any remotes

0 commit comments

Comments
 (0)