Skip to content
Back

Query.search limitation

  • 0
  • 3
  • Databases
x
2 Mar, 2026, 13:54

Since string is deprecated I used varchar, and now I cant use Query.contains , so I setup fulltext index and started using Query.search the issue is Query.search is very bad at searching, if I have string abc-123 then I have to write abc to get the row, otherwise no other way will match such as bc or 123 I guess it have an issue with special characters or numbers. or it's just bad at doing search.

TL;DR
Searching for a specific string containing special characters was causing mismatches, fixed by using quotes around the string in the search query. Further investigation needed for partial matches after a hyphen. Original query issue resolved by using varchar with contains function.
x
3 Mar, 2026, 21:33

?

4 Mar, 2026, 06:51

ummm i think varchar should work with contains, let me check

4 Mar, 2026, 07:02

Hey, can you share the issue you get when trying to use contains on a varchar?

For the search issue, there is a 3 char min for matches; bc can never match. 123 should though. Are you sending it as a string? Query.search('', '123')?

x
4 Mar, 2026, 07:09

this is from console

4 Mar, 2026, 07:13

Thanks, checking on this

x
4 Mar, 2026, 07:15

yes its string but the other issue with special characters say the string SWT-2621-44 when searching the same text it will return all ones that match the SWT not caring if match the reset of the text after the - character

4 Mar, 2026, 07:18

This one I think is a quirk of the DB, because - is considered a stop character. Can you try with it in quotes? Like Query.search(attribute, '"SWT-2621-44"')

x
4 Mar, 2026, 07:20

cool, that works, will update my code to prefix search string with

x
4 Mar, 2026, 07:46

that still has the weird issue such anything after - must be full to match so SWT-262 wont match SWT-2621

4 Mar, 2026, 10:42

Hmm not sure about this one, will check it out

4 Mar, 2026, 10:42

A fix for the original query issue using varchar with contains is live now, let me know if you still have issues with it

1
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