Breaking Ties in NLP Filters - nlpFilterOrder

nlpFilterOrder

Answers currently offers powerful natural language processing (NLP) features by allowing admins and Hitchhikers to turn on nlpFilter, which helps filter down search results based on the users query alone. In some cases, however, the same filter value exists in two different fields that have nlpFilter turned on. In a scenario like this, the actual filter that is selected and applied is arbitrary, which has caused some headaches in the past.

To combat this, we’re introducing a new vertical-level config option called nlpFilterOrder. This array will allow you to specify the order in which you’d like nlpFilters to be selected when conflicts happen.

As an example, a healthcare client has Cardiology as a value in their specialties field and their builtinFile.medicalConditions field. Before nlpFilterOrder, a search for “cardiology near me” would trigger one of these filters arbitrarily. Now, an admin/HH is able to choose which is prioritized in a tie like this. Below is what a config might look like to specify specialties showing up first.

Specialties first in the array means it will be given priority in the case of a tie. Validation code dictates that any field name put in the nlpFilterOrder array must be a searchable field with “nlpFilter” set to true.

"verticals": {
    "facilities": {
      "entityTypes": [
        "healthcareFacility"
      ],
      "name": "Facilities",

      // New nlpFilterOrder array
      "nlpFilterOrder": [
        "specialties",
        "builtinFile.medicalConditions"
      ],
      "searchableFields": {
        "builtinFile.medicalConditions": {
          "nlpFilter": true
        },
        "specialties": {
          "nlpFilter": true
      },
      "source": "KNOWLEDGE_MANAGER"
    }
4 Likes