Search manager to search for entities


We tried to use search manager to search for entities
It works fine BUT RelevantSort is not working
We want to sort results as described there
Standart SearchSiteAction can do it
How can we implement it in a plugin?

Hi @anna,

Can you give some more content on what exactly is wrong with RelevantSort?
What’s the result you’re expecting and what’s the actual result?


See screenshots:

When we compare results of our search via RelevantSort with standart search results - there are differences in sorting order
There is a piece of code we use to search for Confluence items with RelevantSort

        SearchSort sort = new RelevanceSort();

        if (contributor != null) {
            ConfluenceUser cuser = userAccessor.getUserByName(contributor);
            if (cuser != null) {


        SearchFilter securityFilter = SiteSearchPermissionsSearchFilter.getInstance();
        ResultFilter resultFilter = new SubsetResultFilter(startIndex, 10);

        ISearch search = new Search(new InSpaceQuery(where), sort, securityFilter, resultFilter);
        ISearch originSearch = predefinedSearchBuilder.buildSiteSearch(params, startIndex, MAX_RESULTS_PER_PAGE);

Hello there,

have you perhaps resolved or found the cause of this behaviour? I have a similar situation where I have a custom property to order by, but within that I also want to preserve the relevance sorting as the secondary order bay. I do that by using MultiSearchSort, but it doesn’t output the results in the correct order. Since my custom SearchSort is sorting by content types, it’s obvious the results are not sorted by relevance as they are by default, even though I am using RelevanceSort.

I also tried using only RelevanceSort as sort for my property (essentially ignoring my “order by” clause), and the same problem persists.