On Virtual agent , if genius result is unhelpful, prevent it from appearing as a search result
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2022 06:04 PM
In the virtual agent, if the user performs a search and no topics are currently available for that search, an AI Search Fallback flow is triggered. The current setup would allow the user to type a statement and if there is no topic but a genius result available it will trigger the genius card to show.
They will then be prompted to ask if the recommendation was helpful via a YES/NO response.
If they click NO we want to provide them with the additional 3 search results in a hope to find a match.
In it's current state the search still includes the standard link for the same thing that was offered in the genius card. It shows a default top 3 search results (regardless of where the genius result sits).
How can we prevent the search result that came up as a genius result and was unhelpful from showing up as part of the search results again?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2022 11:09 PM
Hi Farah,
This is for San Diego/Tokyo release.
The AI search topic using the Run AI Search topic block, that returns the Genius Results and the Search results. Search results always returned and the Genius result is always the first search result (if there is a Genius result).
When the Genius result is not helpful, the topic shows the Search Results (including the Genius result as the first search result). It is controlled by the VAAISearchHelper script include's generateSearchResultsResponse method. In that method there is a for loop that generates the list for the (by default) 3 additional results.
for (i = 0; i < maxResults; i++) {
var searchResult = response[i];
var propValues = searchResult.propValues;
var model = propValues.model;
/*...
...
...*/
}
You can extend that script include and override this method in a way that the for loop starts from i=1 instead of i=0 leaving the genius result out and change the AI Search Fallback topic's Display Result Links bot response to use your extended script include when the Genius result is not useful.
The other way is to remove the first result from the returned Search Results. If you take a look at the search_result variable that is used in the Display Result Links bot response, it looks like this:
{
result=[{
executionTime=2949,
sysId=0cac8b3073ad101052c7d5fdbdf6a78a,
executionResult={
searchMetadata={
sortOptions=[],
selectedSortOptionIds=[],
filters=[{
sysId=2029d438976195185697f87de053afa7,
label=Catalog Item}],
appliedFacetFilters=[],
searchResultMetadata={
searchTerm=azure devops,
matchedQueryIntents=,
correctedSearchTerm=null,
nextPageToken=b2Zmc2V0OjAsLTEw,
count=10, matchedGeniusResultIntents=,
queryLanguage=en, previousPageToken=null,
responseTimeInMs=231},
searchFacets=[],
selectedFilterIds=[]},
searchResultsTemplates={
items=[{
template=sn-search-result-evam-card,
propValues={
titleEmoji=,
contextEmoji=,
contextSeparator2=|,
description=General requests for <highlight>Azure DevOps</highlight>,
...
...
}},
{NEXT RESULT},
{NEXT RESULT}
]
...
From this variable you have to remove the result...searchResultTemplates.items[0] element.
I hope this helps,
Richard

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2022 11:14 PM
oh, I forgot: if you extend that script include and override this method that the for loop starts from i=1 instead of i=0 you have to change the end condition for the loop also:
for (i = 1; i < maxResults + 1; i++)
You get the idea. Just make sure to leave the first element out and make sure the loop runs maxResults times 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 07:16 PM
Thanks Richard. That's great help. I ended up doing something similar to what you mentioned. Initially, I went down the route of excluding the first result when the genius result is unhelpful. However, I realised that sometimes, the second search result can end up being the genius result as well - found that on thorough testing. Finally, I ended up comparing the sys ids of the genius result and the search results and excluding the search result that has the same sys id as the genius result.