Firestore Query Warning with "price" equality filter and OrderBy set to the same "price" field
Following warning is reported by our custom FirestoreAdapter, when a user chooses to filter by a particular price and then sorts the results by price in the Filter Dialog-
2021-03-21 23:29:04.761 7574-7574/? W/FirestoreAdapter: onEvent:error
com.google.firebase.firestore.o: INVALID_ARGUMENT: Order by clause cannot contain a field with an equality filter price
at com.google.firebase.firestore.p0.b0.k(Unknown Source:22)
at com.google.firebase.firestore.k0.o.b(Unknown Source:30)
at com.google.firebase.firestore.k0.o0.r(Unknown Source:41)
at com.google.firebase.firestore.k0.o0.c(Unknown Source:83)
at com.google.firebase.firestore.k0.g0$b.c(Unknown Source:6)
at com.google.firebase.firestore.o0.m0.D(Unknown Source:69)
at com.google.firebase.firestore.o0.m0.s(Unknown Source:55)
at com.google.firebase.firestore.o0.m0.d(Unknown Source:0)
at com.google.firebase.firestore.o0.m0$a.e(Unknown Source:2)
at com.google.firebase.firestore.o0.t0.u(Unknown Source:21)
at com.google.firebase.firestore.o0.t0.n(Unknown Source:2)
at com.google.firebase.firestore.o0.b$c.g(Unknown Source:42)
at com.google.firebase.firestore.o0.d.run(Unknown Source:4)
at com.google.firebase.firestore.o0.b$a.a(Unknown Source:21)
at com.google.firebase.firestore.o0.b$c.d(Unknown Source:6)
at com.google.firebase.firestore.o0.t$a.c(Unknown Source:2)
at e.a.k1.p$e$b.b(Unknown Source:40)
at e.a.k1.p$e$b.a(Unknown Source:18)
at e.a.k1.x.run(Unknown Source:6)
at e.a.k1.z1.run(Unknown Source:11)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.p0.g$c$b.run(Unknown Source:15)
at java.lang.Thread.run(Thread.java:929)
Caused by: e.a.e1: INVALID_ARGUMENT: Order by clause cannot contain a field with an equality filter price
at e.a.d1.c(Unknown Source:2)
at com.google.firebase.firestore.p0.b0.k(Unknown Source:0)
at com.google.firebase.firestore.k0.o.b(Unknown Source:30)
at com.google.firebase.firestore.k0.o0.r(Unknown Source:41)
at com.google.firebase.firestore.k0.o0.c(Unknown Source:83)
at com.google.firebase.firestore.k0.g0$b.c(Unknown Source:6)
at com.google.firebase.firestore.o0.m0.D(Unknown Source:69)
at com.google.firebase.firestore.o0.m0.s(Unknown Source:55)
at com.google.firebase.firestore.o0.m0.d(Unknown Source:0)
at com.google.firebase.firestore.o0.m0$a.e(Unknown Source:2)
at com.google.firebase.firestore.o0.t0.u(Unknown Source:21)
at com.google.firebase.firestore.o0.t0.n(Unknown Source:2)
at com.google.firebase.firestore.o0.b$c.g(Unknown Source:42)
at com.google.firebase.firestore.o0.d.run(Unknown Source:4)
at com.google.firebase.firestore.o0.b$a.a(Unknown Source:21)
at com.google.firebase.firestore.o0.b$c.d(Unknown Source:6)
at com.google.firebase.firestore.o0.t$a.c(Unknown Source:2)
at e.a.k1.p$e$b.b(Unknown Source:40)
at e.a.k1.p$e$b.a(Unknown Source:18)
at e.a.k1.x.run(Unknown Source:6)
at e.a.k1.z1.run(Unknown Source:11)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.p0.g$c$b.run(Unknown Source:15)
at java.lang.Thread.run(Thread.java:929)
Looks like we need to disable the sort option on price when a particular price is selected by the user.
@kaushiknsanji thanks for pointing this out! You're right, that's a bug.
@kaushiknsanji thanks for pointing this out! You're right, that's a bug.
@samtstern You may refer the above recent commit referenced here. This commit is done on my own repository (not forked) which uses ViewBinding.
I'm also having the same problem in the web version