Faceted search and result count
This section explains how faceted search queries in GraphQL can return numbers of results that seem counterintuitive, but actually follow from the underlying algorithm.
- General flow of a faceted search query
When processing a faceted search query, the Public Content API performs a number of actions before, during and after running the query, based on how the query is specified. - GraphQL sample queries for faceted search
The following queries are all related to the faceted search feature. - 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 valuetcm), with two facets specified. The query explicitly asks for 1 result (in the lineresults (first: 1)) and so it returns the first of 284 hits. - Faceted search result count query 2: a minimal faceted search using OR
This second query adds a concept to the query, but using an OR operator. Because of this, the total number of hits is the same as in query 1, that is, 284. - Faceted search result count query 3: a minimal faceted search using AND
The third query adds a concept to the query using an AND operator. Because of this, the total number of hits is fewer than in queries 1 and 2: the number of hits is now not 284 but 2, because there are aggregations for 2 items. - Faceted search result count query 4: a faceted search without any criteria
The fourth query doesn't set any criteria and therefore yields 0 results, but it does yield aggregations for all content across Tridion Docs and Tridion Sites.