recommendations

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.

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

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.

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