Running Confluence 6.9.1
I am issuing the following REST request:
/rest/api/search?expand=content.history&cql=text~"widget" and type IN (page, blogpost, comment, attachment)&start=0&limit=1000&excerpt=indexed"
The actual number of matching documents is 107 and this is what is returned in the totalSize property of the response.
However, I actually receive only 53 items in this case, where items is the number of 'content' nodes in the result which also equals the value of the 'size' property of the result. I would have expected to get 107. In fact, no matter what I set limit to, I don't get that number of items returned. If I set limit=10, I get back 4 items. If I set no limit (which defaults to 25), I get back 11 items. Start is always set to 0 in these tests.
Can anyone tell me what I'm doing wrong?
As far as I know the search API relies of Confluence search index and if this goes out of sync then the call starts to return incorrect data
Try rebuilding your Confluence search index: Content Index Administration
That appears to have been the problem. Thank you @Alex Medved _ConfiForms_ ! I was running against one of our Confluence test instances. So although I'm not quite sure why search index was out of sync, I'm not surprised. After I rebuilt the index, I got the expected search results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brian,
I am not on the Confluence Team, but I will try to help.
I suspect that you need to encode some of that string to be url-safe.
eg.
/rest/api/search?expand=content.history&cql=text~%22widget%22%20and%20type%20IN%20%28page%2C%20blogpost%2C%20comment%2C%20attachment%29&start=0&limit=1000&excerpt=indexed"
I hope that helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, but I don't think this is the problem. The request URL is actually URL-encoded in some downstream code. I showed the un-encoded URL for better readability. I added some debug output to confirm that the URL is encoded before I make the request.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.