This is my code to search in the firebase database but it only searches from the start not in between.
private void processSearch(String query) {
Query query1 = databaseReference.child("posts").orderByChild("bookName").startAt(query).endAt(query+"\uf8ff");
query1.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
for (DataSnapshot dataSnapshot : snapshot.getChildren()){
AllPostItemHelper itemHelper = dataSnapshot.getValue(AllPostItemHelper.class);
itemHelper.setPostId(dataSnapshot.getKey());
allPostItemSearch.add(itemHelper);
}
AllPostItemAdapter allPostItemAdapter = new AllPostItemAdapter(allPostItemSearch,getContext());
postThings.setAdapter(allPostItemAdapter);
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
}