Cannot filter by custom fields, nor get custom knowledge article fields in the search response

ZoranG
Tera Contributor

I’ve encountered a roadblock with knowledge search, both on the portal and the API (sn_km_api/knowledge/articles). I would greatly appreciate any help or advice.

 

Summary of the problem:  How can I configure KBSearch to use a custom table (u_kb_template_*) that extends kb_knowledge instead of kb_knowledge?

 

Steps I’ve taken:

  • Created a custom article template that introduces several new fields to the knowledge articles. These fields are automatically prefixed with u_kb_* as expected.
  • Configured the form layout and list view, allowing me to enter and edit articles as defined in the template.
  • Configured the list view and can filter by any of the fields. This works great.
  • Configured a portal for the KB and verified that the search on the portal (and through the API) includes the custom fields and returns articles that match the entered text in the custom fields too.

The problem (applicable to both portal search and API):

  • I cannot configure KBSearch to use the table with the custom fields (u_kb_template_*); it only searches kb_knowledge.
  • I can only ask for fields that are on kb_knowledge (e.g., author), but not any of the custom fields (u_kb_*). (e.g. the fields parameter will return core fields, but not custom ones)
  • I cannot create filters based on any of the custom article fields.

However:

  • The search does return articles that match the entered text when found in the custom fields.
  • The article snippet includes text from the custom fields, but the format is not as desired.

Questions:

  1. Has anyone managed to create filters for custom fields and have custom fields included in the search response (in the fields block of each item)? How?
  2. How can I modify the format of the snippet returned with each result?
6 REPLIES 6

Mark Manders
Mega Patron

What is the reason for even starting with this kind of customization? If fields are needed you can add them to the normal knowledge table? Even hide them through ui policies/client scripts if only applicable for certain KB's/articles. 

Knowledge is not a simple record/list functionality like incidents. There is a huge block of functionality behind it, in which you need to put a lot of customization, running the risk of breaking on every next upgrade.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

When I created a new article template, it did that automatically. 

How can I add them to the core table instead?

I believe the user is using the out of the box article template functionality not any kind of customization for the new table/fields.

That is correct. I introduced a new article template using out of the box functionality.