Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firestore Query Warning with "price" equality filter and OrderBy set to the same "price" field #118

Open
kaushiknsanji opened this issue Mar 21, 2021 · 3 comments

Comments

@kaushiknsanji
Copy link

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.

@samtstern
Copy link
Contributor

@kaushiknsanji thanks for pointing this out! You're right, that's a bug.

kaushiknsanji added a commit to kaushiknsanji/firestore-friendly-eats-android that referenced this issue Mar 23, 2021
…rice

Fixes issue "firebase/friendlyeats-android#118" by removing the "Sort by Price" option when user filters results by a particular Price. The "Sort by Price" option is added back when user does not filter by a particular Price, i.e., when user sets the "Price" spinner to "Any price" option.
kaushiknsanji added a commit to kaushiknsanji/firestore-friendly-eats-android that referenced this issue Mar 24, 2021
…rice

Fixes issue "firebase/friendlyeats-android#118" by removing the "Sort by Price" option when user filters results by a particular Price. The "Sort by Price" option is added back when user does not filter by a particular Price, i.e., when user sets the "Price" spinner to "Any price" option.
@kaushiknsanji
Copy link
Author

@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.

@jailsondamasceno
Copy link

jailsondamasceno commented Aug 15, 2021

image
I'm also having the same problem in the web version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants