The Query whereIn not works in firestore when the array has more than 10(size).
Invalid Query. 'in' filters support a maximum of 10 elements in the value array.
this is my code
Query query = postRef.whereIn("id", postIdList).orderBy("timestamp", Query.Direction.ASCENDING);
PagedList.Config config = new PagedList.Config.Builder()
.setInitialLoadSizeHint(10)
.setPageSize(3)
.build();
FirestorePagingOptions<Posts> options = new FirestorePagingOptions.Builder<Posts>()
.setLifecycleOwner(this)
.setQuery(query,config,Posts.class)
.build();
firestorePagingAdapter = new FirestorePagingAdapter<Posts, PostPagingAdapter>(options) {
@NonNull
@Override
public PostPagingAdapter onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = getLayoutInflater().inflate(R.layout.post_items,parent,false);
return new PostPagingAdapter(view);
}
@Override
protected void onBindViewHolder(@NonNull PostPagingAdapter holder, int position, @NonNull Posts model) {
holder.bind(model);
}
@Override
protected void onError(@NonNull Exception e) {
super.onError(e);
Log.e(TAG, "onError: " + e.getMessage());
}
@Override
protected void onLoadingStateChanged(@NonNull LoadingState state) {
super.onLoadingStateChanged(state);
switch (state) {
case LOADING_INITIAL:
case LOADING_MORE:
mSwipeRefreshLayout.setRefreshing(true);
break;
case LOADED:
case FINISHED:
mSwipeRefreshLayout.setRefreshing(false);
break;
case ERROR:
Toast.makeText(getApplicationContext(), "Slow internet connection", Toast.LENGTH_SHORT).show();
mSwipeRefreshLayout.setRefreshing(false);
break;
}
}
};
bookmarks_recycler_view.setAdapter(firestorePagingAdapter);
Anybody pls help to get more than 10 arrayFields in Firestore WhereIn query