When I use Query.search() instead of returning rows with the keywords provided it just returns all the rows in the table.
TL;DR
Issue: Query.search() function is returning all rows in the table instead of filtering by the provided keywords.
Solution:
Instead of passing the 'content' column directly, use Query.field("content") inside Query.search() to specify the field to search in. Update the code as follows:
```typescript
queries: [Query.search(Query.field("content"), query)],
```
This will correctly filter rows based on the provided keywords.TypeScript
try {
return await tablesDB.listRows<Post>({
databaseId: CRIC_TALK_DATABASE_ID,
tableId: POSTS_TABLES_ID,
queries: [Query.search("content", query)],
});
} catch (error) {
console.log(`Error while searching posts ${error}`);
throw error;
}
}```
this is the code i am using
[SOLVED] Query.search() returning all rows in the table
Recommended threads
- Usage of the new Client() and dealing wi...
Hey guys, just a quick one - we had some web traffic the other day and it ended up bombing out - To put in perspective of how the app works, we have a Nuxt Ap...
- Increase by operators
I see appwrite have bunch of useful operators for querieng db. One more I would like to suggest is operators like increase the count of a int columns by 1,2.. ...
- createCollection Deprecated