Back

Query OR , AND syntax

  • 0
  • Self Hosted
  • Tools
  • Web
  • Databases
Suiii
29 Aug, 2023, 02:16

How can I create OR or AND in query

I want input string: xxx => then any code, familyName, .... contain xxx will return

TL;DR
The user is asking about the syntax for using logical OR and AND in a query. They mention that logical OR is not currently supported. The suggestion given is to create an attribute with all the data they want to search against and then search on that attribute. The user also asks about using the "startWith" query and how to search for specific keywords. It is stated that the startWith query works when typing an exact keyword and an example code is provided. The user also asks about using the "&" symbol in the search and it is mentioned that it is not currently available but there is a workaround suggested, which is to create another attribute
Binyamin
29 Aug, 2023, 02:18

This is not available yet. You can track that issue progress here As for now, a quick workaround would be create another attribute named search that contained all those value separate by space. then, add full-text index for that attribute

Suiii
29 Aug, 2023, 03:43

then how can the search like &xxx&

Suiii
29 Aug, 2023, 03:43

search , return specific right?

Binyamin
29 Aug, 2023, 13:58

Like

TypeScript
Query.search("search", "key words")
Suiii
29 Aug, 2023, 15:03

its only works when I type exact keyword = attribute of doucment

Binyamin
29 Aug, 2023, 15:04

Ohh, yes for that part the start with you'll still use the startWith query

Suiii
29 Aug, 2023, 15:37

is this going to be out any time soon

Suiii
29 Aug, 2023, 15:38

if so I would not need to write custom logic to create conditional search

Binyamin
29 Aug, 2023, 15:39

For that you'll need to ask <:appwrite:637383039499894787> core member

Drake
29 Aug, 2023, 17:57

Sorry I don't understand what you're trying to do

Suiii
30 Aug, 2023, 01:54

bascially, when send the search string to server, it could search in multiple attributes

Drake
30 Aug, 2023, 01:57

Ah right. Logical OR is not supported like Binyamin said. I don't know when it will be added.

For now, I suggest creating an attribute with all the data you want to search against. Then, you can search on that attribute

Suiii
30 Aug, 2023, 03:34

any example of that

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