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

Open
#118 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
android, kotlin

Research direction

Start at the custom FirestoreAdapter and the Filter Dialog, then reproduce the case where a particular price is filtered and sorting is also set to price. Done means this combination no longer produces the reported Firestore warning, with price sorting disabled when that equality filter is selected.

Written by the indexing model from the issue text.

Description

type: bug

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.

Dominant language
Kotlin
Stars
295
Forks
168
Avg merge
3d 15h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/friendlyeats-android

All issues in firebase/friendlyeats-android

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.