Apply a lambda function to filter out content that meets specified criteria yet is not pinned to a location in a data feed.

list filter_content( array input , lambda definition )

Evaluates a lambda for every element in the list, and returns a new list with only the elements that evaluated to true as well as any items that were saved as a pinned item in Recommendation Manager. This is especially useful for filtering out content items based on their properties, such as URL or tags, or filtering out duplicate content items.

If you want to filter objects other than a data feed, such as arrays, use filter() instead of filter_content(). You should also use filter() if you want to filter data feed content without regard to whether items are pinned.


Filtering only for pieces of content that are tagged furniture:

{content = filter_content(content, lambda x: contains(x.tags, 'furniture'))}

Filter out pieces of content that are tagged “explicit-content”:

{content = filter_content(content, lambda x: !contains(x.tags, 'explicit-content'))}

Removing duplicate content based on title:

{duplicates = []}
{content = filter_content(content, lambda x: contains(x.title, duplicates)?false:duplicates = duplicates + [x.title] || true)}