Answers API - Vertical Query - facetFilters - ID Reference?

I have a custom entity that has a custom field (c_newsInsightTypeMultiOption, which is a Multi-Option Select Field Type) with the following options.

  • In the News (5773290, IN_THE_NEWS)
  • Insights (5773291, INSIGHTS)
  • Life at Company (5773292, LIFE_AT_COMPANY)
  • Press Releases (5773293, PRESS_RELEASES)

When we initiate a vertical query, we’re passing the text value, per the documentation.

{
  "c_newsInsightTypeMultiOption": [
    {
      "c_newsInsightTypeMultiOption": {
        "$eq": "In the News"
      }
    }
  ]
}

As you can see in my bulleted list, the values have associated IDs (both numeric and text) in the KnowledgeGraph. These IDs can’t be used in queries. Is there a reason that the values in a multi-select field don’t have an “API Name” or “ID” field just as the field does? I tried querying using the IDs and, as expected, the filtering doesn’t work.

{
    "c_newsInsightTypeMultiOption": [
      {
        "c_newsInsightTypeMultiOption": {
          "$eq": "5773290"
        }
      }
    ]
  }

Are there any recommended work-arounds? Are there other field types that I could configure to solve for this issue?

Hey Zach,

Are you running into problems when passing the text value within the facetFilter parameter for your vertical queries? If so, could you provide an example GET request that is failing? Feel free to take out the API Key from the example request to keep things private!

Best,
DJ

We’re not running into many problems at present, more just preparing for the future. I think it’s a case of having to encode the filters when we didn’t think we would need to.

While these filter values are pretty plain, should we add more detailed filter values in the future with characters that would need to be encoded, e.g. reserved characters: ␣ ! # $ % & ’ ( ) * + , / : ; = ? @ , we’d need to be mindful about that. It seems that most everything has an ID in Yext, and even in the case here, the field values do, they just can’t be used in facetFilters for one reason or another.

Ah, understood! I’d suggest putting this on the Ideas Board to put this potential functionality on the Answers team’s radar!

1 Like