marklogic-community / data-explorer

Data Explorer Tool
Other
15 stars 4 forks source link

Unable to get to the Select Fields part of the adhoc wizard #171

Closed cskeefer closed 5 years ago

cskeefer commented 6 years ago

When clicking the Select Fields button in the adhoc wizard, an error is displayed on the screen and the following is in the log:

2018-08-30 13:35:24.540 Notice: XDMP-AS: (err:XPTY0004) $items as xs:string* -- Invalid coercion: json:object(<json:object xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>) as xs:string
2018-08-30 13:35:24.540 Notice:+in /server/lib/to-json-lib.xqy, at 29:59 [1.0-ml]

To recreate:

It looks to me like the error occurs in api-adhoc-query-wizard.xqy in the following line:

to-json:seq-to-array-json(lib-adhoc:get-databases())

That function expects a sequence of database names but now it is supplied with JSON that has both the database name and the count of documents.

Easy fix is probably to add '/names' on the call to lib-adhoc:get-databases() to extract just the database names. We might also want to send a param to lib-adhoc:get-databases that determines if the counts are calculated also since we don't always want/need the counts.

Also as part of this, look at all calls to lib-adhoc:get-databases() and make sure they are set for the JSON (name/count) response.

cskeefer commented 5 years ago

Closing because merged in #174