The knowledge base search does not work on the Service Management Help Center while it works on project specific portals
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When searching for knowledge base articles from the Help Center page (Service Management home page /servicedesk/customer/portals), no articles are found:
However, when searching for knowledge articles from a specific Service Management Portal (/servicedesk/customer/portal/<PORTAL_ID), articles are found:
Environment
Any Jira Service Management Server/Data Center version configured with an application link to any Confluence Server / Data Center version.
Cause
Root cause 1
A high number of Jira Service Management (JSM) projects are configured with a knowledge base space, and we are hitting the JSM bug - JSDSERVER-10987Getting issue details... STATUS , which is a direct consequence of the Confluence bug - CONFSERVER-33174Getting issue details... STATUS
When a customer searches for a key word from the Customer Portal homepage (Help Center), JSM sends an API call to Confluence using the end point knowledge-base/1.0/search using the following query (AA, BB, CC, DD... being the Confluence space keys linked to the JSM projects):
queryString=(keyword)+AND+(spacekey:"AA"+OR+spacekey:"BB"+OR+spacekey:"CC"+OR+spacekey:"DD"...)
If there is a too high number of JSM projects, the query received by Confluence will exceed the character limit that Confluence can handle (256 characters), as per the Confluence Bug. In such case, the search will be dropped by Confluence, and no article will be shown on the JSM Customer Portal.
Root cause 2
The Jira application is configured with 2 or more application links, each pointing to a different Confluence instance, and we are hitting a limitation described in the JSM feature request - JSDSERVER-8513Getting issue details... STATUS
In such case, when a customer searches for a key word from the Customer Portal homepage (Help Center), JSM will only search for this word on the Confluence instance set as primary in Jira > ⚙ > Applications > Application Links. If the relevant articles are located in the Confluence instance not set as primary, then no article will be found and no results will be returned on the Customer Portal.
Diagnosis
For Root cause 1
- Replicate the issue after enabling the debugging package org.apache.http with the DEBUG level in Jira > ⚙ > System > Logging an Profiling
Check the Jira logs after the issue was replicated and look for the query sent from the Jira application to the Confluence application, which should look like the one below:
2021-04-30 10:17:53,671+0300 http-nio-8080-exec-9 DEBUG jirauser XXXxXXXXXXXxXX xxxxxx xxx.xx.x.xxx,0:0:0:0:0:0:0:1 /rest/servicedesk/knowledgebase/latest/articles/shared/search [o.a.h.impl.execchain.MainClientExec] Executing request GET /rest/knowledge-base/1.0/search?type=page&queryString=%28laptop%29+AND+%28spacekey%3A%22AA%22+OR+spacekey%3A%22BB%22+OR+spacekey%3A%22CC%22+OR+spacekey%3A%22DD%22+OR+ ... %22%29&pageSize=3&startIndex=0&highlight=true&xoauth_requestor_id=jirauser HTTP/1.1
If you decode the URL of the request sent from Jira to Confluence using https://www.urldecoder.org/, you should see that the querystring parameter from that URL looks like this:
queryString=(keyword)+AND+(spacekey:"AA"+OR+spacekey:"BB"+OR+spacekey:"CC"+OR+spacekey:"DD"...)
- Check the size of the entire string. If it exceeds 256 characters, then this root cause is relevant
For Root cause 2
- In Jira, go to ⚙ > Applications > Application Links, and check if there are at least 2 Confluence application links
- If there are at least 2, check which Confluence instance is set as primary. If the Confluence instance that contains the knowledge base articles is not set as primary, then this root cause is relevant
Solution
For Root cause 1
Option 1
The bug https://jira.atlassian.com/browse/JSDSERVER-10987 was fixed in JSM 5.11.0, but this fix will only work if JSM is linked to a Confluence application using the version 8.5.0 or any version above.
As a result, to benefit from the fix that was implemented for this bug in JSM, you will need to perform the 2 upgrades below:
- Upgrade JSM to the version 5.11.0 (or any higher version)
- Upgrade Confluence to 8.5.0 (or any higher version)
Option 2
If upgrading JSM and Confluence is not a not option for you, the only way to workaround the issue is to configure fewer JSM projects with a knowledge base space, in order to ensure that the search query sent from JSM to Confluence does not exceed the limit of 256 characters that is hardcoded in Confluence.
For Root cause 2
- Set the Confluence instance that contains the knowledge base article as primary in Jira > ⚙ > Applications > Application Links
- Note that this workaround will only work if you are only using 1 single Confluence instance as a knowledge base resource. If you are using multiple Confluence instances for knowledge space purpose, there is unfortunately no workaround.