Skip to content
Back

Sync with meilisearch Java template build error

  • 0
  • Functions
Danish
6 Oct, 2023, 13:37

Also in the sdk-for-kotlin, the listDocuments function is different from what is mentioned in the nodejs template of sync with meilisearch. The nodejs function is:

TypeScript
      process.env.APPWRITE_DATABASE_ID,
      process.env.APPWRITE_COLLECTION_ID,
      queries
    );```
The docs in sdk-for-kotlin says to use:
```databases.listDocuments( "[DATABASE_ID]", "[COLLECTION_ID]", new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; }

    System.out.println(result);
})
);```
I'm confused on where to use the queries in java template?
TL;DR
The user is encountering a build error while using the MeiliSearch Java template. They are unsure where to use the 'queries' parameter in the Java template. They have provided code snippets and error messages. Solution: The user should use the 'queries' parameter in the 'listDocuments' function in the Java template. They can refer to the provided code snippets for guidance.
darShan
6 Oct, 2023, 13:54

Java -

TypeScript
databases.listDocuments("dbId", "collectionId", queries, callback);

See source: https://github.com/appwrite/sdk-for-android/blob/main/library/src/main/java/io/appwrite/services/Databases.kt

Danish
6 Oct, 2023, 15:00

Used above reference and got this error: /usr/local/server/src/main/java/io/openruntimes/java/src/Main.java:127: error: no suitable method found for listDocuments(String,String,List<String>) DocumentList<Map<String, Object>> response = databases.listDocuments( ^ method Databases.<T#1>listDocuments(String,String,List<String>,Class<T#1>,Continuation<? super DocumentList<T#1>>) is not applicable (cannot infer type-variable(s) T#1 (actual and formal argument lists differ in length)) method Databases.<T#2>listDocuments(String,String,Class<T#2>,Continuation<? super DocumentList<T#2>>) is not applicable (cannot infer type-variable(s) T#2 (actual and formal argument lists differ in length)) method Databases.listDocuments(String,String,Continuation<? super DocumentList<Map<String,Object>>>) is not applicable (argument mismatch; List<String> cannot be converted to Continuation<? super DocumentList<Map<String,Object>>>) where T#1,T#2 are type-variables: T#1 extends Object declared in method <T#1>listDocuments(String,String,List<String>,Class<T#1>,Continuation<? super DocumentList<T#1>>) T#2 extends Object declared in method <T#2>listDocuments(String,String,Class<T#2>,Continuation<? super DocumentList<T#2>>)

code: DocumentList<Map<String, Object>> response = databases.listDocuments( System.getenv("APPWRITE_DATABASE_ID").toString(), System.getenv("APPWRITE_COLLECTION_ID").toString(), queries );

Danish
6 Oct, 2023, 16:53

I think I misunderstood the function

Danish
6 Oct, 2023, 16:54

What is the output of databases.getDocuments() function?

Danish
6 Oct, 2023, 16:56

Input params are databaseID, collectionID and queries string.

Danish
6 Oct, 2023, 16:56

Output is DocumentList right?

Danish
6 Oct, 2023, 17:12

@Steven can you help me out here?

Drake
6 Oct, 2023, 18:25

please do not tag people as it can be very disruptive

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