Thank you for the suggestion, but I have a space named “Team” and the CQL space.title ~ "Team" doesn’t return any result through the Java API. It does return something through the Confluence search.
Found the answer! One needs to call .search() and not .searchContent():
cqlSearchService.search(
"type = \"space\" and title ~ \"Tea*\"",
searchOptions, new SimplePageRequest(0, 20)
).getResults()
returns the space Team (and title ~ "Tea" doesn’t, so the * is actually useful).