Replacement for searchfilter permissions in Confluence 8.0 API

We need to update our plugin for compatibility with Confluence 8.0, since com.atlassian.confluence.search.v2.searchfilter.SiteSearchPermissionsSearchFilter; was removed and can no longer be used.
The documentation we found regarding this issue has not been helpful. Many threads mention SiteSearchPermissionsQuery as an alternative, but it is marked as internal and can therefore not be used in our plugin.
The official Atlassian documentation for the v2 search API still only has an example using the deprecated code.

This was our code so far, can anyone help on how to achieve something similar with the Confluence 8.0 API?

import com.atlassian.confluence.search.v2.query.BooleanQuery;
import com.atlassian.confluence.search.v2.searchfilter.SiteSearchPermissionsSearchFilter;

....

ContentSearch search = new ContentSearch(BooleanQuery.composeAndQuery(allQueries), RELEVANCE_SORT, SiteSearchPermissionsSearchFilter.getInstance(), 0, 1);
1 Like

We are also running into that problem - have you managed to find a solution?

This is how I resolved the issue after reading this answer, you have to inject the factory:

private final SiteSearchPermissionsQueryFactory siteSearchPermissionsQueryFactory;


    public YourService(@ComponentImport SiteSearchPermissionsQueryFactory siteSearchPermissionsQueryFactory) {
        this.siteSearchPermissionsQueryFactory = siteSearchPermissionsQueryFactory;
    }

Then you can get a SearchQuery like this:

Set<SearchQuery> queries = new HashSet<>();
queries.add(siteSearchPermissionsQueryFactory.create());
SearchQuery query = BooleanQuery.composeAndQuery(queries);