Back

iOS Search Query not working as expected

  • 0
  • Databases
  • Apple
  • Cloud
Burkle
9 Sep, 2024, 01:11

The search query is not working as expected. When I search for part of a username in my code, it doesn't return documents unless I include the first part of the username (as if it was a "starts with" query). This is my code:

let usernameDocuments = try await databases.listDocuments( databaseId: databaseId, collectionId: "#############", queries: [ Query.search("username", value: username), ] )

Based on the documentation (https://appwrite.io/docs/products/databases/queries) this requires a full text index, which I have created already.

A recent support entry here suggested using contains, but Query.contains is not available for iOS (?).

TL;DR
The search query in the iOS code is not working as expected - it's behaving like a "starts with" query instead of a partial match. The developer is using Query.search("username", value: username) but it only returns documents if the full username is included. The documentation states a full text index is needed, which has been created. Query.contains is not available for iOS.
D5
9 Sep, 2024, 01:52

I think it's like Query.search("text", "key words")

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