Documentation Center

Faceted search result count query 1: a faceted search with minimal search criteria

A query that gets all content published from Tridion Sites Content Manager (identified by the namespace value tcm), with two facets specified. The query explicitly asks for 1 result (in the line results (first: 1)) and so it returns the first of 284 hits.

Query

{
  search(
    criteria: {
      field: {key: "namespace", value: "tcm"}
    }
    facets: {
      concepts: [
        {first: 20, connectorId: "ingredients"},
        {first: 20, connectorId: "glassware"},
      ]
    }
  )
  {
    facets (language: "english") {
      __typename
      ... on ConceptFacet {
        connectorId
        title
        concepts {
          label
          count
          id
        }
        uri
      }
    }
    results (first: 1) {
      hits
      edges {
        node {
          search {
            id
            locale
            conceptSchemes {
              connectorId
              concepts {
                label
                id
              }
            }
          }
        }
      }
    } 
  }
}

Response

{
  "data": {
    "search": {
      "facets": [
        {
          "__typeName": "ConceptFacet",
          "connectorId": "glassware",
          "title": "Glassware",
          "concepts": [
            {
              "label": "",
              "count": 2,
              "id": "e-learning-poolparty-biz_cocktails_e576e848_0f11_4f7a_b6b3_1ff820b02023"
            }
          ],
          "uri": "e-learning-poolparty-biz_cocktails_f09732a9-a0e6-494a-8ce9-299ef036aaaf"
        },
        {
          "__typeName": "ConceptFacet",
          "connectorId": "ingredients",
          "title": "Ingredients",
          "concepts": [
            {
              "label": "",
              "count": 5,
              "id": "e-learning-poolparty-biz_cocktails_8352ad8c_0355_4ca4_9ff7_c3dff28931c5"
            },
            {
              "label": "",
              "count": 2,
              "id": "e-learning-poolparty-biz_cocktails_3c94f5fc_4664_4177_a880_88643c0be9c1"
            },
            {
              "label": "",
              "count": 1,
              "id": "e-learning-poolparty-biz_cocktails_8d5e2abc_6280_42b7_8e21_8bbc30f7509f"
            },
            {
              "label": "",
              "count": 1,
              "id": "e-learning-poolparty-biz_cocktails_9c2ce399_c6ae_4f4d_bf37_7fd8ffe2a19d"
            }
          ],
          "uri": "e-learning-poolparty-biz_cocktails_eff672ac-6601-42c6-a3e9-0adda3b45df8"
        }
      ],
      "results": {
        "hits": 284,
        "edges": [
          {
            "node": {
              "search": {
                "id": "tcm_5-2004",
                "locale": "en_US",
                "conceptSchemes": []
              }
            }
          }
        ]
      }
    }
  }
}