Searching by tags for these entites results in a query using group by and having. This was working fine for the actual
content queries but the count queries were getting messed up because it couldn't count the result properly as it was just
and array of 1's being return (counting the group size and all were one). It was actually the length of the result set we'd
have wanted for the total count. This wouldn't work though for the ones were tags weren't involved because that query doesn't
have a group by and a having.
This change modifies the count queries to instead of trying to count directly with the same where predicate it actually
counts the results of the real query as a subquery (all on database side so it doesn't return all the data). This way it
doesn't matter if there's a group by or not. Now the total results returned via the API in the Page object are correct and
pagination can continue properly.
Coverage increased (+0.02%) to 93.787% when pulling 0bd5a1eefd13748451b11b66cf2ece75f3d3cf8a on tgianos:tagSearchBugFix into 57183d1a97efb0f3e665d44ff2679e3f2e6ac946 on Netflix:4.1.x.
Searching by tags for these entites results in a query using
group by
andhaving
. This was working fine for the actual content queries but the count queries were getting messed up because it couldn't count the result properly as it was just and array of 1's being return (counting the group size and all were one). It was actually the length of the result set we'd have wanted for the total count. This wouldn't work though for the ones were tags weren't involved because that query doesn't have a group by and a having.This change modifies the count queries to instead of trying to count directly with the same where predicate it actually counts the results of the real query as a subquery (all on database side so it doesn't return all the data). This way it doesn't matter if there's a
group by
or not. Now the total results returned via the API in thePage
object are correct and pagination can continue properly.