For the sake of handeling infinite scroll, I created a function that add conditions to the query according to the desired behavior: