Search manager to search for entities

Hello!

We tried to use search manager to search for entities
https://docs.atlassian.com/confluence/5.8.9/com/atlassian/confluence/search/v2/SearchManager.html
It works fine BUT RelevantSort is not working
https://developer.atlassian.com/static/javadoc/confluence/4.0/reference/com/atlassian/confluence/search/v2/sort/RelevanceSort.html
We want to sort results as described there
https://confluence.atlassian.com/confkb/how-do-i-understand-the-ranking-of-confluence-s-search-results-785614686.html
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?

Hello!

See screenshots: https://drive.google.com/file/d/0BwzedJ6VKLxWOWpac2Z0OU1na1U/view?usp=sharing
https://drive.google.com/file/d/0BwzedJ6VKLxWRjhoR3Fyc2wybU0/view?usp=sharing

Hi
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();
        params.setSort(sort);

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

        timer.start("Search");

        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.