Virtual agent : Some catalog items and record producers are not showing in the search result

jacque3
Kilo Guru

Hi Everyone,

I'm currently working on a Virtual Agent(Search Topic) in which  I have used the Script from ITSM virtual agent plugin-

sn_itsm_va.VAContextualSearchUtil().
 
I have 3 test catalogs(2 catalog items and 1 record producers) with Meta tags , short description;
find_real_file.png
Search Context I have used:
find_real_file.png
Script that I have used in testing:
var context = '6f7e3f565b30130070e4492c11f91aea';
    
var contextualSearch = new sn_itsm_va.VAContextualSearchUtil();
var response = contextualSearch.search(context, 'Severance');
var success = contextualSearch.processSearchResponse(response);
var relevantSearchResults = contextualSearch.processGeneralResults(response, 20,0);
var kbResultCount = relevantSearchResults.length;
var search_kb_json_string = JSON.stringify(relevantSearchResults);

gs.info("SEARH RESULT: " + search_kb_json_string );

I have tried searching with a keyword Severance  I have expected to have these 3 items in the results but I only got one ,which is the Separation with Severance catalog item only:

[{
	"snippet": "Separation with <B>Severance</B>",
	"image": {
		"thumbnail": {
			"link": ""
		},
		"link": ""
	},
	"related_links": [{
		"sp_link": "?id=sc_cat_item&sys_id=6ee57a0513dc360099f85566",
		"link": "com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=6ee57a0513dc360099f85566",
		"title": "Order"
	}],
	"meta": {
		"score": 549.3299,
		"description": "",
		"interleaved": true,
		"source": "catalog"
	},
	"link": "cxs_cat_item.do?sysparm_id=6ee57a0513dc360099f85566",
	"id": "sc_cat_item:6ee57a0513dc360099f85566",
	"title": "Separation with Severance"
}]
Does anybody know how does Contextual search works? which field is being checked?
 
Thank you 
6 REPLIES 6

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Today I ran into the same issue. Already saw (in Madrid version) that in the 'Order an Item' topic, on the Script Action 'Contextual Search', the script mentions on line 14/15:

    //Filter out any catalog items that should not be shown ie. Record Producers
    //create a filterMap to quickly see if item can be shown to user

This implies that Record Producers are being filtered out. Looking at the script, on line 16 a variable called "vaVars.filter_tables" is mentioned.
Looking at that variable, a Script Variable within the topic actually, it contains "sc_cat_item_content,sc_cat_item_producer,sc_cat_item_wizard,std_change_record_producer,sc_cat_item_producer_service".
So the answer being, literally sc_cat_item_producer is being filtered out! Also tested this, removed the sc_cat_item_producer, published the topic, refreshed the Virtual Agent... works!

find_real_file.png

Also, If you have a lot of matched Catalog Items, only 5 will be shown. Reason being, the topic has a Script Variable called "limit". The value for this Script Variable obviously being 5.

Kind regards,
Mark

 

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi there,

Please mark this answer as correct if it solves your problem. This will help others who are looking for a similar solution.
Thanks.

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Thanks Mark, your update resolved my one of the issue.Changed the limit value and working expected. 

 

But another issue found is, in the 'Order an Item' topic the search result is showing some non-related items also.

Can you please tell how does Contextual search works? which field is being checked?

Mark Roethof
Tera Patron
Tera Patron

Hi there,

If my answer helped you in any way, please then mark it as helpful.

Please mark this answer as correct if it solves your problem. This will help others who are looking for a similar solution.
Thanks.

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn