Skip to content

ContentTypeGroupId Criterion

The ContentTypeGroupId Search Criterion searches for content based on the ID of its content type group.

Arguments

  • value - int(s) representing the content type group ID(s)

Example

PHP

1
$query->query = new Criterion\ContentTypeGroupId([1, 2]);

REST API

1
2
3
4
5
<Query>
    <Filter>
        <ContentTypeGroupIdCriterion>[1, 2]</ContentTypeGroupIdCriterion>
    </Filter>
</Query>
1
2
3
4
5
"Query": {
    "Filter": {
        "ContentTypeGroupIdCriterion": [1, 2]
    }
}

Use case

You can use the ContentTypeGroupId Criterion to query all Media content items (the default ID for the Media content type group is 3):

1
2
3
4
5
6
7
8
        $query->query = new Criterion\ContentTypeGroupId([3]);

        $results = $this->searchService->findContent($query);
        $media = [];
        foreach ($results->searchHits as $searchHit) {
            $media[] = $searchHit;
        }
    }

REST API

1
2
3
4
5
  <Query>
    <Filter>
        <ContentIdCriterion>[69, 72]</ContentIdCriterion>
    </Filter>
  </Query>
1
2
3
4
5
"Query": {
    "Filter": {
        "ContentIdCriterion": [69, 72]
        }
    }