Facet Fields Response Field

The facetFields field will be populated if if any facet field counts were requested in the query. Each facetField contains the following fields:

  • fieldName – the name of the field being faceted
  • displayName – the human friendly name of the field being faceted
  • combineMode – the mode with which the value filters were applied for the counts
  • pageNumber – the current page number for the counts
  • pageSize – the current page size for the counts
  • hasLimitingValue – whether or not this facet field has any potentially limiting value filters
  • hasAppliedValue – whether or not this facet field has any currently applied value filters
  • removeCommand – command to remove this facet field from the list of requested facet fields
  • counts – list of the facetCount items for the individual facet values

Each facetCount contains the following potential fields:

  • value – the text value for this count
  • count – the document count
  • isApplied – whether or not there is a facet value filter already applied for this facet value
  • isNegated – whether or not the associated facet value filter is currently negated
  • isFurtherLimiting – whether or not this facet value filter could further refine the result set
  • applyCommand – available if not isApplied – the command to apply a facet value filter for this facet value
  • applyNegatedCommand – available if not isApplied – the command to apply a negative facet value filter for this facet value
  • removeCommand – available if isApplied – the command to remove the facet value filter for this facet value
  • negateCommand – available if isApplied – the command to negate the facet value filter for this facet value

The counts field is the only list on facetField, so there is no nested element for it.

Example – A facetFields element in XML format

<facetFields>
  <facetField
   fieldName="ContentType_sfacet"
   displayName="ContentType"
   combineMode="or"
   pageNumber="1"
   pageSize="10"
   hasLimitingValue="true"
   hasAppliedValue="true"
   removeCommand="removeFacetField(ContentType)"
   listValuesCommand="listFacetValues(ContentType,or)"
   removeValueFiltersCommand="removeFacetValueFilter(ContentType)">
    <facetCount
     value="Journal"
     count="74926"
     isApplied="true"
     isNegated="false"
     isFurtherLimiting="true"
     removeCommand="removeFacetValueFilter(ContentType,Journal)"
     negateCommand="negateFacetValueFilter(ContentType,Journal)"/>
    <facetCount
     value="Book"
     count="1984"
     isApplied="true"
     isNegated="false"
     isFurtherLimiting="true"
     removeCommand="removeFacetValueFilter(ContentType,Book)"
     negateCommand="negateFacetValueFilter(ContentType,Book)"/>
    <facetCount
     value="Newspaper"
     count="1012"
     isApplied="false"
     isNegated="false"
     isFurtherLimiting="true"
     applyCommand="addFacetValueFilter(ContentType,Newspaper,false)"
     applyNegatedCommand="addFacetValueFilter(ContentType,Newspaper,true)"/>
  </facetField>
</facetFields>

Example – A facetFields object in JSON format

"facetFields":[
  {
    "fieldName":"ContentType_sfacet",
    "displayName":"ContentType",
    "combineMode":"or",
    "pageNumber":1,
    "pageSize":10,
    "hasLimitingValue":true,
    "hasAppliedValue":true,
    "removeCommand":"removeFacetField(ContentType)",
    "listValuesCommand":"listFacetValues(ContentType,or)",
    "removeValueFiltersCommand":"removeFacetValueFilter(ContentType)",
    "counts":[
      {
        "value":"Journal",
        "count":115206,
        "isApplied":true,
        "isNegated":false,
        "isFurtherLimiting":true,
        "removeCommand":"removeFacetValueFilter(ContentType,Journal)",
        "negateCommand":"negateFacetValueFilter(ContentType,Journal)"
      },
      {
        "value":"Book",
        "count":3608,
        "isApplied":true,
        "isNegated":false,
        "isFurtherLimiting":true,
        "removeCommand":"removeFacetValueFilter(ContentType,Book)",
        "negateCommand":"negateFacetValueFilter(ContentType,Book)"
      },
      {
        "value":"Newspaper",
        "count":2384,
        "isApplied":false,
        "isNegated":false,
        "isFurtherLimiting":true,
        "applyCommand":"addFacetValueFilter(ContentType,Newspaper,false)",
        "applyNegatedCommand":"addFacetValueFilter(ContentType,Newspaper,true)"
      }
    ]
  }
]