Watson APIs

Watson Assistant Search Skill - results quantity in custom UI

By Tim Lai posted Thu December 03, 2020 06:42 PM


Watson Assistant can search Watson Discovery documents through the Search Skill.  The Search Skill has various configuration settings including the number of results to return from the Watson Discovery search as illustrated by the screen shot below:

The “Adjust result quantity” defaults to 3, and you can adjust it lower or up to 10.  This setting will take effect immediately once you Save if you are using the standard Watson Assistant Web Chat Widget. 

If you are using a custom UI for your virtual agent (chatbot) interface, you may not see the effect of this settings change.  In order to see that change in custom code, you must call the Watson Assistant REST API with a version date of 2020-09-24 or later.  You can find the latest version dates from the Watson Assistant release notes:

An example REST API call is the following with the 2020-09-24 version specified:

If your REST API call is using an older version date, the response JSON will return a results array of up to 10 docs. 

If you use the 2020-09-24 version, the json response returns a "primary_results" array equal to the quantity you specified in the “Adjust result quantity” setting in the Search Skill, followed by an "additional_results" array which contains the rest of the up to 10 results.  Your custom UI code can display the “primary_results” array.  The example json response below is with the “Adjust result quantity” set to 1.