Skip to content

Debug Information in Searching

Debug information about searches can be included in the results when using Autenticated Search.

To include information the field Explain in the AuthenticatedSearchModel must be set to true when creating an AuthenticationToken

1
2
3
4
var authSearchModel = new AuthenticatedSearchModel(segmentId)
{
  Explain = true
};

Using the token in searches the response will contain explanations about the Business rule conditions that are matched in the search.

{
  "explanation": [
    {
      "description": "Matching business rules",
      "details": [
        {
          "description": "Business rule BusinessRuleActionId { BusinessRuleAction = RelevanceBoost, EntityId =  } with id BusinessRuleId { Id = 4a3075ff-efc9-4041-9efb-64a90ec6597b } and conditions",
          "details": [
            {
              "description": "BusinessRule matches condition scope with value full-search",
              "details": []
            },
            {
              "description": "BusinessRule matches condition Color with value orange",
              "details": []
            }
          ]
        },
        {
          "description": "Business rule BusinessRuleActionId { BusinessRuleAction = Facets, EntityId =  } with id BusinessRuleId { Id = 7df07994-c895-452e-b310-0c92771d863d } and conditions",
          "details": [
            {
              "description": "BusinessRule matches condition scope with value full-search",
              "details": []
            },
            {
              "description": "BusinessRule matches condition Color with value orange",
              "details": []
            }
          ]
        },
        {
          "description": "Business rule BusinessRuleActionId { BusinessRuleAction = ParameterSet, EntityId =  } with id BusinessRuleId { Id = 9c684715-7559-4eb1-ac32-71ef4479bf7b } and conditions",
          "details": [
            {
              "description": "BusinessRule matches condition scope with value full-search",
              "details": []
            }
          ]
        },
        {
          "description": "Business rule BusinessRuleActionId { BusinessRuleAction = SemanticSearchBoost, EntityId =  } with id BusinessRuleId { Id = 530b9bf1-787c-4292-81a7-2aa8d055beac } and conditions",
          "details": [
            {
              "description": "BusinessRule matches condition scope with value full-search",
              "details": []
            }
          ]
        }
      ]
    }
  ]
}

The explanation also contains a Playground link that can be used in Playground to load the conditions of the specific search to investigate the result of the search.

1
2
3
4
{
    ...,
    "playgroundLink": "https://localhost:8020/discover/playground?link=eyJzZWdtZW50SWQiOiJiMmMtZGstZGEiLCJjb25kaXRpb25zIjp7InNjb3BlIjoiZnVsbC1zZWFyY2giLCJwaHJhc2Vfc2VhcmNoIjoidHJ1ZSIsInNwZWNpZmljX3BocmFzZSI6ImRhbSB0LXNoaXJ0IiwiQ29sb3IiOiJvcmFuZ2UifX0"
}