export function getAttributeTypeLookup()

in src/search/facets/utils.ts [19:36]


export function getAttributeTypeLookup(
  index: Kendra.DescribeIndexResponse
): IndexFieldNameToDocumentAttributeValueType {
  if (
    !index ||
    !index.DocumentMetadataConfigurations ||
    _.isEmpty(index.DocumentMetadataConfigurations)
  ) {
    return {};
  }

  const types: IndexFieldNameToDocumentAttributeValueType = {};
  for (const field of index.DocumentMetadataConfigurations) {
    types[field.Name] = field.Type as DocumentAttributeValueType;
  }

  return types;
}