how can I search given string in multiple attribute of a documents and return the matching documents
- 0
- Databases
- General
- Web
- Cloud
how can I search given string in multiple attribute of a documents and return the matching documents. for example I have string "xyz" which could be present in attribute "cityname" or "countryname" . how can I list those documents which contains "xyz" either in "cityname" or "countryname".
Right now I am not able to find a way to find this. Please help.
As of now there is no direct way of doing so.
What's common is to:
- Create another attribute named
search - And then, create a function that will get trigger for each time the a document is updated in that collection.
- Then, in that field you can concat all the searchable strings separate by
empty space. - Apply Full text index on that field
- Search that filed and it will search over all the searchable attributes.
this is a common scenario. i thought there would be direct solution to it.
Appwrite will add support to "OR" queries in v1.5 and it will be released very soon. It will be possible to do what you're looking without any extra effort
thats so good to hear
Recommended threads
- Project Paused Despite Daily Active Usag...
I noticed that my project was automatically **paused**, even though it is actively being used. The project is an **attendance application** that is used daily b...
- Hi Appwrite Support Team,My project has ...
Details: Project ID: 69a69f6f00113ed0e8e4 Region: SFO (sfo.cloud.appwrite.io) Error Response: Affected: ALL endpoints ā Functions, Databases, Storage, Health, ...
- Sudden CORS Errors - Domain hasn't Chang...
I have an Appwrite project with two web apps configured, the first one has the hostname `*` and the second one I just added to test if it could fix the issue wi...