@azure/search-documents javascript sdk, SearchDocumentResult return facets

76 Views Asked by At

The facets property of SearchDocumentResult should return the facets involved in the query as well as their values, right? But it only returns undefined. If this is the expected behavior, is there another way to consult the facets through sdk?

1

There are 1 best solutions below

2
On

This link provides you more information about the facets. As you can see in the article, facets are a collection(arrays in JS) of facetable values defined in the index.

For example, if you define an index 'Hotel', you can mark its properties 'HotelId' and 'Rating' as facetable. The results will be displayed accordingly. In the result, you will be able to read 'HotelId' and 'Rating'.

But, there will not be any seperate property by name 'facets' from which you can read the list of facets that you passed.