0
votes

I am using Query Options to return facets on Full Name. Below is the snippet.

"constraint": [
          { 
          "name": "Full Name",
          "range": 
                         {
          "type": "xs:string",
          "element": {"name": "Full Name" }
                         }
          }
          ]

I am able to return the facets as expected.

"facets":    {
   "Full Name":       {
      "type": "xs:string",
      "facetValues":          [
                     {
            "name": "John H",
            "count": 1,
            "value": "John H"
         },
                    {
            "name": "Jim White",
           "count": 1,
           "value": "Jim White"
        }
     ]
   }
} 

However, I have an additional properties, like email address, phone number etc, also to be returned. Can I return additional properties also under the "facets" property, without having to create range indexes? I see that all properties are returned under results.extracted.content property, but I am trying to return all the required properties together as shown below.

"facets":    {
   "Full Name":       {
      "type": "xs:string",
      "facetValues":          [
                     {
            "name": "John H",
            "count": 1,
            "value": "John H"
            "email": "[email protected]",
            "phone": "123456789"
         },
                    {
            "name": "Jim White",
           "count": 1,
           "value": "Jim White"
            "email": "[email protected]",
            "phone": "123456789"
        }
     ]
   }
} 
1

1 Answers

0
votes

Facets don't work that way. Facets are designed to return unique values with a frequency count. Because of that they are not linked to actual documents like that. If you wish to return property combinations, I see two more obvious choices:

  • transform the search result to not just extract other values, but pull out combinations of values together, for instance using REST transforms
  • use a tuples definition to pull up combinations from multiple range indexes at the same time. Works with the /v1/values endpoints

HTH!