Fetching similar content

Fetching similar content

Display content similar to a given item based on common content attributes and content. Check out the Recommendations guide for a quick introduction.

The GraphQL API creates a corresponding GraphQL Type with a "similarity" algorithm for each content model in your environment. The plural Type name of the content model is prefixed with Similar_. For example Post generates a Type Similar_Posts. Pagination options (except limit) and the total items field are disabled when using this query.

query {
  Similar_Posts(
    id : "b3f76d7d-732b-4fd6-a9e9-a967dba3d09b" ) {
    items {
        _id,
        title
    }
  }
}

Filtering recommended content items

To narrow down the recommended content items, use the same filters that are available when filtering collections.

In the following example, we query all Posts where premium is set to true.

query {
  Similar_Posts(
    id : "b3f76d7d-732b-4fd6-a9e9-a967dba3d09b", where : { premium : true } ) {
    items {
        _id
    }
  }
}

Was this article helpful?

We’d love to learn from your feedback