Confluence Cloud Search API - score always 0 for results

Hi guys,

I’m approaching Confluence Cloud Rest APIs and I cannot understand how the /search API works… As described in the documentation (here it should return a set of results with the score property, but it’s always zero.

I tried to look in the docs for more detailed info, but I wasn’t able to find anything useful.

Any hint?
Thank you in advance.

Regards,
Andrea

7 Likes

Hello @AndreaRinaldi , and welcome to the Developer Community.

There is no mention of any score property on that page you linked to. What does this ‘score’ property correlate to in Confluence Cloud, or what is it meant to contain?

You have to click on the SearchPageResponseSearchResult link, it opens a dialog with the response model that mentions the score property!
image

@AndreaRinaldi

Here is a screen grab of the dialogue window that appears when clicking on SearchPageResponseSearchResult link, which is a list of the objects that can be returned:

There is no object called score. If you follow the next level down to the possible content of the SearchResult object then, yes, there is a non-required score object in the next level down.

There is no description of what the purpose of the score object is, nor what is used to populate its value, only that its value would be an integer. Given that the documentation doesn’t say what this number represents, how its value is populated and that it’s not required (mandatory), it could be just a placeholder object that Atlassian put there for future use, and all it currently does is store a dummy value. Maybe it had a use a long time ago, but it’s no longer in use.

What are you expecting ‘score’ to mean and what are you expecting the numerical value to be? If you always get 0 as its value, then the chances are that’s because it is zero… because there’s nothing in Confluence to cause it to be anything else.

You might be chasing a ghost.

The score property should be evaluated as stated in this documentation page: How do I understand the ranking of Confluence's Search Results | Confluence | Atlassian Documentation

And we need that property in order to merge Confluence results with a set of results coming from external systems, normalising the different sets of results.

But that property seems to be not evaluated by Confluence. But without a valid reason: since it’s listed in the documentation without any sort of disclaimer it should be expected to be returned with a proper value.

There is nothing on that page that says the search ‘score’ referred to there is the same thing as the score object you are accessing via the REST API; they are just the same word,. The article also uses the words ‘weighting’ and ‘weight’ as synonyms.

I would suggest you raise a support request with Atlassian to confirm that the search score referred to in that article correlates to the score object described in the relevant section of the REST API documentation and, if so, how does that object get populated with a value and what does the value represent. Maybe also request that the REST API documentation be updated to describe the object better.

So, I can’t help any further.