1

I have viewed the results of the API that get the facet data and it returns the below :

{  
   "TotalTime":20,
   "QueryTime":18,
   "Signature":null,
   "Index":"sitecore_master_index",
   "Facets":[  
      {  
         "Key":"facet",
         "Name":"facet",
         "Values":[  
            {  
               "Name":"result4",
               "Count":1
            },
            {  
               "Name":"August 2017",
               "Count":1
            },
            {  
               "Name":"result1",
               "Count":1
            },
            {  
               "Name":"result2",
               "Count":2
            },
            {  
               "Name":"result3",
               "Count":1
            }
         ]
      }
   ]
}

can I extend the API to return an additional field other than Name and count?

1 Answer 1

1

No, there is no simple way to achieve that. You would need to modify SearchController and few more classes to achieve that. Believe me - you don't want to go that way.

If you really want your custom solution/custom structure of response I would suggest implementing new service for this. Take a look at GetFacets() method in SearchController and FacetSet class.

1
  • Thanks Dawid, what i need to achieve that i have a date column that i need to display it in format "MMM, yyyy" in dropdown so i thought of adding computed index field that will store the date formatted and display it in SXA facet dropdown but i need to sort this dropdown by the date value so i though of passing this from api as the name and the count, do you have any suggestions?
    – NAli
    Jun 1, 2018 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.