In typical online review system if any user give review on specific post or others thing, then when that user view that post his review show first. The perfect example of this is Google Play Store. If i give review to any app, than when i go to that app my review show first.
Now i want to implement review system in my app. I implemented it successfully but now I'm little bit confused to showing that to the users. I want to show current user review first if that user give any review to that post as I mentioned before. I can simply do that if I fetch all the data at a time by doing filter for current user but as I'm using pagination and don't getting all the data at a time so I can't do that because theres no guaranty that the current user data will exists in that page.
So the way i think to solve the problem is below:
For first page call I can make two call to database one for to get only current user review data and second to get all review data by paging. Then if current user review data exists I will add this data to the beginning of all data.
But there has one problem, as I'm calling current user review data separately still my main call which getting all review data may exist that current user review data. It means current user review data maybe duplicates. So, to prevent duplicates data I can exclude current user data from all data call but that will put an extra load to the sever as it will check every data and then will skip current user data if exits.
So I'm looking for an efficient way to show users review by doing pagination, where first review will be current user review if it exists. How can I do that?