Enable Full Knowledge Base Search by Ignoring Taxonomy in Portal
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago - last edited an hour ago
Overview
By default, ServiceNow Knowledge Search in Service Portal uses taxonomy filtering, which limits results to only taxonomy-linked articles.
To allow search across the entire Knowledge Base, we modify the Search Source script to ignore taxonomy.
This is useful for portals where AI Search is not enabled and taxonomy is attached, but users still need access to all knowledge bases associated with the portal from the homepage search widget.
Steps
1.Navigate to:
All → Service Portal → Search → Search Sources
2.Open the Knowledge Base (OOB) Search Source
3.In the Script section, locate the data fetch script
4.Add the below variable at the top
var ignoreTaxonomy = true;
5.Update the logic to ignore taxonomy:
Replace:
if (!taxonomyId) {
...
} else {
variables.taxonomy_topic = facets.topic;
}
With:
if (!taxonomyId || ignoreTaxonomy) {
// KB-based search
} else {
variables.taxonomy_topic = facets.topic;
}
6.Update facet query condition:
Replace:
if (taxonomyId)
With:
if (taxonomyId && !ignoreTaxonomy)
Result
- Search returns all knowledge articles related to the knowledge bases attached to the portal
- Not restricted to taxonomy
- Useful for Business, CSM, and custom portals
Notes
- The value of
ignoreTaxonomy(true/false) can be controlled using a System Property instead of hardcoding in the script. - Avoid directly modifying the OOB (Out-of-Box) Search Source, as it is a high-risk file.
Instead:- Create a new Search Source record
- Copy the OOB configuration
- Change the ID
- Apply your script changes there
0 REPLIES 0
