Watson Discovery Java Passages Missing

254 Views Asked by At

How can I get the passages result using Java sdk?

On the documentation of Watson discovery is write that in query options you could set the passages options. But the class QueryOptions where you could set passages exist only in the version 3.9.2 that is only on github and isn't complete. Also using the version 3.9.2 with:

    QueryOptions queryOptions = new QueryOptions.Builder(environmentId, 
    collectionId).passages(true).query(query).build();

   QueryResponse queryResponse = discovery.query(queryOptions).execute();

Is possible to set the passages parameter but in queryResponse the parameter is missing.

2

There are 2 best solutions below

0
On

For now QueryResponse doesn't support passages so they there aren't in the return value of discovery.query(queryOptions).execute()

0
On

Try version 4.0.0 of the java-sdk, it supports passages now:

https://github.com/watson-developer-cloud/java-sdk/tree/develop/discovery