Back

getting an empty list or error when try to query a document

  • 0
  • Self Hosted
  • Flutter
  • Databases
Ernest
13 Dec, 2023, 16:08

The separator can be anything but I think a space would work best. Also, you should probably look into using a function to populate the composite attribute field of all existing data and even going forward.

TL;DR
The user is experiencing issues querying a document. They suggest searching one column at a time and using a JSON version of the attributes they want to search. The user doesn't fully understand the solution provided and asks for more information. The suggestion is to use a function to populate the composite attribute field and suggest using a space as a separator. There is a mention of a bug and the user will wait for it to be fixed. They provide their code and a link to a related issue.
Faisal7
13 Dec, 2023, 16:31

yes i can confirm that as well i just now tryed in GraphQl the same with query.select it works.

Faisal7
13 Dec, 2023, 16:32

this sounds to me alot work and complex somehow

Faisal7
13 Dec, 2023, 16:37

i think this is maybe related to my issue https://github.com/appwrite/sdk-for-flutter/issues/173

ZachHandley
13 Dec, 2023, 16:39

What’s your code?

Faisal7
13 Dec, 2023, 16:40

listDocuments( databaseId: Env.databaseId, collectionId: Env.locationsTableId, queries: [ Query.search('Name', query), Query.search('Addresse', query), Query.select(["Name", "Addresse"]), ]);

Faisal7
13 Dec, 2023, 16:41

my code

Ernest
13 Dec, 2023, 16:43

Yes, that's the same bug

Faisal7
13 Dec, 2023, 17:15

ok then for now i cant do anything then just wait for the bug to be fixed and wait for the implementation of the OR condition

ZachHandley
13 Dec, 2023, 17:15

So

ZachHandley
13 Dec, 2023, 17:15

OR works in certain conditions like

ZachHandley
13 Dec, 2023, 17:15

Query.equal(‘attribute”, [string1, string2, etc])

ZachHandley
13 Dec, 2023, 17:16

But if you just want to search for one thing

ZachHandley
13 Dec, 2023, 17:16

You can use the same trick I use

ZachHandley
13 Dec, 2023, 17:17

I have an Appwrite function that automatically finds any collection with a ‘search’ attribute and, when updated or created, JSON stringifies the object (minus the search field and any I don’t want searchable) into the search column which is then full text indexed

ZachHandley
13 Dec, 2023, 17:18

so when I search it’s one search value and I’m searching the whole thing

ZachHandley
13 Dec, 2023, 17:18

Do you think that would work here

Faisal7
13 Dec, 2023, 17:22

no its not the solution for me but dont have any choice in my point of view.

Faisal7
13 Dec, 2023, 17:23

yes i also want to search the whole collection if its possible but i thaught the way to do so would be like with Query.search operation and the same for all the fields

ZachHandley
13 Dec, 2023, 17:45

The whole collection yeah that’s how I did it

ZachHandley
13 Dec, 2023, 17:45

it’s not a complete solution, but also it actually is pretty nice IMO, it lets me be more selective about what I keep or don’t keep

Faisal7
13 Dec, 2023, 17:50

yes this seams to be good solution but i didnt get it completely what to do. Maybe if you give me some more informations. <i would be very happy

ZachHandley
13 Dec, 2023, 22:16

Basically because you can only full text one attribute to search at a time, if you want to OR search something, make another attribute and whenever you update or create the other attributes, make that attribute just a JSON version of the attributes you want to search, then search that column

Faisal7
17 Dec, 2023, 21:22

would it then work if i have json string in a column and search.

Faisal7
17 Dec, 2023, 21:23

but i have also an idea. What if i search just one column at a time if i get empty list i search then the other colun automatically so it will be two searches.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more