sai pranayOriginal post
Rank 1: Thread
Plain text
if (keyword) { setLoading(true); databases .listDocuments( import.meta.env.VITE_PUBLIC_DATABASE_ID, import.meta.env.VITE_PUBLIC_COLLECTION_ID, [ Query.search("title", keyword), Query.orderDesc("$createdAt"), ] ) .then((response) => { setCrafts(response.documents); console.log(response.documents); }) .catch((error) => { console.error("Failed to fetch user crafts:", error); }); setLoading(false); } }, [keyword]);```
I have 2 different attributes title, description so how i can query both at the same timeSummary
It seems that the user wants to query two attributes at the same time. Currently, this is not supported. However, a possible workaround is to create a new attribute that combines the text from both attributes and use that in the query. Here is an example of how you can modify your code to include the new attribute:
```useEffect(() => {
if (keyword) {
setLoading(true);
databases
.listDocuments(
import.meta.env.VITE_PUBLIC_DATABASE_ID,
import.meta.env.VITE_PUBLIC_COLLECTION_ID,
[
Query.search("newAttribute", keyword),
Query.orderDesc("$createdAt"),
]