Knowledge Search

If you are using Oracle B2C Service Knowledge Foundation or Oracle Fusion Service Knowledge Management, then you can use the built-in Knowledge Search dialog flow component to search for and display articles from that service.

To integrate your skill with a Knowledge Foundation service, you:

  1. Add a knowledge search integration. You only need to do this once per service interface.

  2. Add one or more Knowledge Search components to the skill's dialog flow, as described in Use the Knowledge Search Component.

Add a Knowledge Search Service

To use the Knowledge Search component in a skill to search for and retrieve Oracle B2C Service Knowledge Foundation or Oracle Fusion Service Knowledge Management articles, you must first create a knowledge search service that integrates with the service.

Before you create a knowledge search service for Knowledge Foundation, confirm that your Oracle B2C Service Account Manager has enabled the Connect Knowledge Foundation API at the site level and the II_CONNECT_ENABLED configuration setting is switched on. Otherwise, when you invoke the Knowledge Service component, it will return a global error. The exception code will be ACCESS_DENIED and the message will contain the message base string for SOAP_SERVER_DISABLED. If you plan to integrate with multiple interfaces, then the profile for the user that you use for the service integration must have access enabled for the interfaces.

To create a knowledge search service, complete these steps:

  1. In Oracle Digital Assistant, click Icon to open the side menu to open the side menu, select Settings, select Additional Services, and then click the Knowledge Search tab.

  2. Click + Add Service

    The New Knowledge Search Integration Service dialog displays.

  3. Provide this information:

    Field Required Description
    Name Y A unique name for the integration.
    Description N Description of the integration.
    Service Type Y Select whether this integrates with Oracle B2C Service Knowledge Foundation or Oracle Fusion Service Knowledge Management.
    Host Y The fully qualified domain for the service. For example: interfacename.custhelp.com.
    Service Cloud Version Y (For Oracle B2C Service only) Indicate whether the Oracle B2C Service version is 20A or later, or earlier than that.
    Authentication Type Y (For Oracle Fusion Service only). By default, set to allow both signed-in and anonymous users to access articles.

    Warning: As of 24.02, the option to allow only signed-in users to access the articles is not fully tested.

    User Name Y The user name for the knowledge service account.

    For Oracle B2C Service the user must be associated with a Oracle B2C Service profile that has Public Knowledge Foundation API account authentication and session authentication permissions selected on the Profile Permissions Administration tab. If this service integration will include multiple interfaces, then the profile must have access enabled for the interfaces.

    The user must also have access to the articles that the skill needs to retrieve.

    Password Y The user's password.
    Search Path or Custom URL N If you want the component's search button to go to a custom URL instead of the default search link, you can specify it here. You can use the <SEARCH_TERM> placeholder to specify where to put the search term in the URL.

    Note that for B2C services, if you use an absolute URL, then the skill will not add the search filters that are described in Filter Results by Product and Category to the URL.

    Result Path or Custom URL N If you want the component's show more button to go to a custom URL instead of the default result link, you can specify it here. You can use the <ANSWER_ID> placeholder to specify where to put the article ID in the URL.
  4. Click Create.

    If you are integrating with Oracle Fusion Service Knowledge Management, then skip to Step 7.

  5. For Oracle B2C Service, if the host's site has more than one interface, you will be asked to select the main (default locale) interface.

    You can add more interfaces in the next step. You also can change which interface is the default.

  6. If your Oracle B2C Service service has different interfaces for different locales, click + Add Locale to include them in the service integration. You'll need to select the interface to add and then specify the host for the interface. You only can add one interface per locale.

    Note that the profile for the user that you use for the service integration must have access enabled for the interfaces.

    When a Knowledge Search component uses a multi-interface service integration, you use the Search Using Locale property to specify which interface to search. (In YAML-based dialog flows, it's the locale property.) The property defaults to the profile.locale value. If none of the interfaces support the locale, then the component searches the default interface.

  7. Click Verify Settings to check if Oracle Digital Assistant can connect to the service successfully.

Test Knowledge Foundation Search Terms

For Oracle B2C Service Knowledge Foundation, you can test search terms from the Knowledge Search service page for each configured Oracle B2C Service interface.

To test search terms:

  1. In Oracle Digital Assistant, click Icon to open the side menu to open the side menu, select Settings, select Additional Services, and then click the Knowledge Search tab.

  2. Select the knowledge search service and then click the Service Cloud host for which you want to test the search terms.

    The service's search page displays. Enter the search terms to see the results.

Use the Knowledge Search Component

You use the Knowledge Search dialog flow component to search for and display information from a knowledge service.

Using this component, you specify the search term, the knowledge search service to search, which product or category to search on (or both), and how many results to display. You also can configure labels and prompts. For Oracle B2C Service Knowledge Foundation you can specify whether to display the answer or the special response, and, for multi-locale interfaces, which interface to search. The component property details and transitions are described in Knowledge Search for the Visual Flow Designer (and in System.KnowledgeSearch for dialogs developed in YAML mode).

You can incorporate knowledge search to not only provide answers for specific sets of questions, you can also use knowledge search to handle unresolved intents. If a user's utterance doesn't resolve to any intent within the skill's confidence threshold, then the skill can search the knowledge base using the utterance as the search term. For example, your knowledge base might contain articles about your return policy, shipping return costs, and whether one can return wearable products. Your product order skill could include intents that are specifically tailored to use precise knowledge base searches to return these answers. Should the user ask a related question that your skill doesn't specifically handle, such as a question about warranties, then the question would resolve to the unresolved intent, and your skill could perform a knowledge base search using the user's question as the search term.

To implement this technique, do the following steps:

  1. Associate a set of related questions with a specific search term: For each knowledge base answer that you want to use in the skill, create an intent with a set of example utterances (training corpus). When the user utterance resolves to that intent, transition the dialog flow to a state that searches the knowledge base with a search term that returns the desired answer. The training corpus, along with the natural language parser (NLP), helps the skill resolve questions that are similar to the training corpus to that intent.

  2. Employ the user's utterance as the search term for unresolved intents: If the user utterance doesn't resolve to any intent within the skill's confidence level, then you can transition the dialog flow to a state that searches the knowledge base with the search term set to the user's utterance. That is, perform a roll-over search.

Note that you must first create a knowledge search integration before you can use this component.

Associate Related Questions with a Search Term

While it's possible to simply employ the user's utterance as the search term for a knowledge base search, it's often preferable to leverage the intent and natural language parsing features to ensure that the skill displays the best possible answer for a given question.

By creating an intent for each knowledge base answer that you want to incorporate into your skill, you can use the intent's example utterances (training corpus) to associate various questions with that answer. Using the training corpus, the natural language parser (NLP) will resolve other questions that are similar to the ones in the training corpus to that intent. As your skill is put to use, you can insights and retraining to improve the resolution of utterances to that intent.

When an utterance resolves to one of your intents, which we'll call knowledge intents, transition the dialog flow to a state that searches the knowledge base using a search term that will retrieve and display the desired answer.

As an example, let's say that you have a knowledge base answer about product registration that not only explains how to register a product, but describes the advantages of registering as well as how to update and retire a product. You would start by creating an intent for it (lets call it knowledge.Product Registration). You would then add several example utterances to the intent that illustrate the ways in which people would ask about product registration (you should start with a few dozen examples). Here's a small set of the example utterances you might use for knowledge.Product Registration.

  • how to register my product
  • I need to retire a registered product
  • I want to update registered device
  • is product registration important
  • what are the advantages to registering a device
  • why should we register products

Next, you would need to create a flow to search the knowledge base using a search term that will produce the desired answer. You can either create a knowledge search state for each knowledge intent and hard code the search term, or you can create a single flow and use a map variable to associate your knowledge intents with search terms.

Here are the steps to create a single flow in the Visual Flow Designer for all of the intents that are mapped to a specific search term:

  1. In the Main Flow, create a global variable of type map to associate the knowledge intents with search terms. In this example, we'll call it searchTerms. Here's an example value that you could assign to such a variable if you have six intents:
    {
      "knowledge.Shipping Return Costs" : "Shipping Return Costs",
      "knowledge.Locate Service Tag or Serial" : "Locating Your Service Tag or Asset Serial Number",
      "knowledge.Support Account" : "My Support Account",
      "knowledge.Product Registration" : "How do I register my product?",
      "knowledge.Noncontiguous Delivery Time" : "What is the delivery time to Alaska, Hawaii and the U.S. Territories?",
      "knowledge.Return Policy" : "What is your return policy?"
    }

    Tip:

    This example uses the answer's summary for the search term. With Oracle B2C Service Knowledge Foundation, you also can use the answer's ID.
  2. Start the flow with a Set Variable component and create a variable to hold the intent name (e.g. intentName) and enter the following FreeMarker expression as its value:
    ${skill.system.nlpresult.value.intentMatches.summary[0].intent}
  3. After the Set Variable component you have just added, add another Set Variable component for the search term (e.g. searchTerm) and enter the following FreeMarker expression as its value:
    ${searchTerms.value[intentName.value]}

    This expression uses the searchTerms map you defined earlier to determine the search term based on the resolved intent.

  4. After the second Set Variable component, add a Knowledge Search component and set its to Term to Search For property to ${searchTerm.value}".
  5. In the Knowledge Search component state, set the Search Service Name to the name of the knowledge search service.

  6. After the Knowledge Search component, add the states for the actions, error, and next transitions.

  7. Click Validate to ensure that the dialog flow doesn't have any errors.

  8. Click Train to train the skill with your example utterances.

  9. On the Intents page for the skill, map each of the intents associated with a search term to this flow.

Tip:

The default values for the Text to Display Ahead of Results, Web Article Link Label, and Web Search Page Link Label properties are stored in the skill's resource bundle. To change a default, open the skill's Resources Bundle page by clickingResource Bundles icon, select the Configuration tab, and change the message for the KnowledgeSearch - <property name> key. If you use the skill's resource bundle to change the default, then you don't need to include the property in the component unless you want to override the default.

For an example YAML-based dialog flow using this technique, see Example: Associate Related Questions with a Search Term in a YAML Dialog Flow.

Employ User Utterance as Search Term

A common use for the Knowledge Search dialog flow component is to try and resolve a user's question or request that your skill wasn't designed to handle. If a user's utterance doesn't resolve to any intents, you can use the component to search the knowledge base with the Term to Search For property set to the user utterance. If it doesn't find any results, or if the user doesn't find the results helpful, you can offer other options such as transferring to a live agent or rephrasing the question.

You do so by setting the component's Term to Search For property to ${skill.system.nlpresult.value.query} (which is the expression to retrieve the user's utterance).

In YAML-based dialog flows, you use the searchTerm property and set it to ${iResult.value.query}. For sample YAML code, see Example: Employ User Utterance as Search Term.

Note

Note that this technique handles unresolved intents within a skill. When the flow navigates through the digital assistant's unresolved intent, then the request doesn't go through the skill's Intent Engine and the utterance won't be in ${skill.system.nlpresult.value.query}. In this case, consider creating a state that uses ${system.message.messagePayload.text} for the search string. Then open the digital assistant and, in the Settings > Configurations page, go to Skill State Mappings and set the Digital Assistant Custom UnresolvedIntent Skill and Digital Assistant Custom UnresolvedIntent State to point to this state.

Find Only the Results That Contain Every Word in the Knowledge Foundation Search Term

By default, Oracle B2C Service Knowledge Foundation searches for answers that contain any of the words in the search term. If you want the search to return only the answers that contain every word in the search term, add the following key/value pair to the Custom Properties property in the Knowledge Search dialog flow component:

word_connector: "AND"
Note

The word_connector key is supported for Knowledge Foundation only. Oracle Fusion Service does not support the word_connector property.

If your dialog flow is in YAML mode, the code would look something like this:

  startSearch:
    component: "System.KnowledgeSearch"  
    properties:
      searchServiceName: "KnowledgeSearch"
      searchTerm: "${searchTerm.value}"
      customProperties:
        word_connector: "AND"
    transitions:
      actions:
        resultSent: "offerMoreHelp"
        noResult: "reset"
        serverError: "handleSearchServerProblem"
      error: "handleSearchError"
      next: "reset"

Filter Results by Product and Category

You can have the Knowledge Search dialog flow component return only the search results for a specified product or category (or both).

To limit the results to those related to a product or category, use the Result Filters property. Add Product, Category, and Stripe Code items as needed to define the filter. You can have only one of each type of filter.

Note

If your dialog flow is in YAML mode, use the customFilters property. Add product and category items as needed to specify the product or category filter.
      customFilters:
        - name: "product"
          value: "heart rate monitor"
        - name: "category"
          value: "returns"

Tailor Knowledge Foundation Response for Chat Conversation

Oracle B2C Service Knowledge Foundation answers are typically written for web pages and thus can be too long to fully display in a conversation. For lengthy answers, the output is truncated and the user must click the Show More button to see the full content. When your answer is longer than a short paragraph, consider adding a special response that you tailor specifically for chat conversations.

To display the special response instead of the answer, set the Knowledge Search component's Preferred Version of Results property to Special Response and set Only Show Preferred Version to false. With these settings, the component outputs the special response if it exists. Otherwise it outputs the full answer if the result-size limit hasn't been met.

Note

If your skill is in YAML dialog mode, the corresponding property names are resultVersion and resultVersionExclusive.

The following screenshots show the difference between a full answer and a special response. The first screenshot shows the full answer. Notice how the response to "how do I register a product", which begins with "Did you know that product registration is very important", is not the way a human would respond to the question, and thus is not "conversational." In addition, the full answer is cut off in the middle of the third paragraph. The second screenshot shows the special response, which is more conversational and not truncated.


Description of kf-answer-full.png follows


Description of kf-special-response.png follows

To learn about adding special responses, see HTML Editor for Answers in Using B2C Service.

Remove the View Details Button and Display All the Text

By default, the Knowledge Search dialog flow component just displays the first few lines of the answer along with a button that the user clicks to see the full answer in a browser tab.

If you want it to show all the answer's content, set the Knowledge Search component's Web Article Link Label to On and set the value of the systemComponent_KnowledgeSearch_resultLinkLabel resource bundle key to the FreeMarker literal notation ${r""}.

If your skill is in YAML dialog mode, you accomplish this by setting the System.KnowledgeSearch's resultLinkLabel property to an empty string ("").

Note

If you choose to display the full answer, you should try to limit the answer to just a few screen-fulls of text. Otherwise the user might have difficulty reading the text in a regular-sized chat widget.

Implement Multi-Lingual Knowledge Search

Both Oracle Fusion Service Knowledge Management and Oracle B2C Service Knowledge Foundation support returning results for a specified locale.

For Oracle Fusion Service Knowledge Management, the search automatically returns the articles that are associated with the locale identified by profile.locale. You can override this by setting the component's Search Using Locale property (for YAML dialog mode skills, this is the locale property). If matching articles don't exist for the locale, it returns noResult.

For Oracle B2C Service Knowledge Foundation, the service must have separate interfaces for different locales, and you must configure the Knowledge Search integration to connect with the desired interfaces. When the Knowledge Search dialog flow component is invoked by a skill, it performs the search on the interface for which the locale matches the skill's profile.locale value. You can override this by setting the component's Search Using Locale property (for YAML dialog mode skills, this is the locale property). If there isn't a match, it uses the Knowledge Search integration's default interface.

Here are the steps to create a multi-language Oracle B2C Service Knowledge Foundation search skill:

  1. Add a Knowledge Search Service integration for the main interface. Then add to the integration the locales for the other interfaces that you want the skill to search, and specify the default locale. Note that the profile of the user that you specify for the service integration must enable access for the interfaces.

  2. Create a multi-language skill using one of these options:

  3. Add the Knowledge Search component to the dialog flow. If you don't want the component to use the profile.locale value to determine which interface to search, then set the Search Using Locale property to the desired locale. If none of the interfaces support the locale, then the component searches the default interface.

Knowledge Foundation Sample Skill

For an example of using the System.KnowledgeSearch component, download the CX Service Template, which contains the CXS.KnowledgeSearch skill (developed in YAML mode). See the Oracle Digital Assistant CXS Overview Power Point slides for instructions.

How the Knowledge Search Component Displays in Oracle B2C Service Chat

How the results from the Knowledge Search dialog flow component appear depend on whether they are displayed in the default chat that's accessed through the customer portal or the Oracle Inlay Toolkit embedded chat inlay.

  • Links: Links appear as buttons in the embedded chat inlay. In the default chat, the label is displayed as text, and it is followed by a clickable URL.
  • Multiple Results: When there's more than one result, the results appear as cards either horizontally or vertically depending on the value of the component's cardLayout property (the default is horizontal). In the default chat, the results appear vertically.

Note that images don't appear in the results.

This table illustrates how single and multiple results display in the embedded chat inlay and the default chat.

Example Component Configuration Embedded Chat Inlay Default Chat

Example of a single result (Visual mode):

  • Maximum Number of Results property: 1
  • Web Article Link Label property: On
  • Web Search Page Link Label property: On
  • KnowledgeSearch - resultLinkLabel resource bundle entry: Show More
  • KnowledgeSearch - searchLinkLabel resource bundle entry: Search for Similar Answers

Example of a single result (YAML mode):

component: "System.KnowledgeSearch"
properties:
  ...      
  resultSizeLimit: 1
  resultLinkLabel: "Show More"
  searchLinkLabel: "Search for Similar Answers"
...
Described in text Described in text

Example of multiple results (Visual mode):

  • Maximum Number of Results property: 3
  • Web Article Link Label property: On
  • Web Search Page Link Label property: On
  • KnowledgeSearch - resultLinkLabel resource bundle entry: Show More
  • KnowledgeSearch - searchLinkLabel resource bundle entry: Open Page with All Answers

Example of multiple results (YAML mode):

component: "System.KnowledgeSearch"
properties:
  resultSizeLimit: 3 
  resultLinkLabel: "Show More"
  searchLinkLabel: "Open Page with All Answers"
...
Described in text Described in text

The Knowledge Search dialog flow component supports embedded chat inlay for Oracle B2C Service versions 20A and later. To learn about the embedded chat inlay, see the Oracle Inlay Toolkit documentation.