To filter by the media type you can get the Set of All Reviews for a given MediaType and then use Intersection
.
// ...
mediaRef: Select(0, Paginate(Match(Index('media_by_type'), Var('mediaType')))),
// "media_reviews_by_media" should be generated from GQL schema
reviewsByMediaSet: Match(Index('media_reviews_by_media'), Var('mediaRef')),
// Intersection returns only those elements that are in both Sets
reviesAllFiltersSet: Intersection(
Var('taggedReviewsSet'),
Var('reviewsByMediaSet')
),
sortedSet: Join(
Var('reviesAllFiltersSet'),
Index('reviews_by_ref__created_asc')
),
// ...
For more Set operations like Intersection
, check out the FQL cheat sheet.
You may want to allow users to provide a variable amount of filters (provide null
for some terms) For tips on how to mix and match different terms with FQL you can check out this previous topic. SELECT FROM myIndex WERE a=1 AND b=2 AND c=3