0

I want to have a custom endpoint for search in which I can pass custom json object in body of POST Request search-custom.sjs from which I want to call a xquery module.

/data-hub/src/main/ml-modules/services/search-custom.sjs has

function post(context, params, input) { let request = JSON.parse(input)
return
xdmp.invoke("/lib/search-lib.xqy",request,[]); }

exports.POST = post

But I am unable to invoke this xquery file. Also If I call the endpoint from postman http://localhost:8011/v1/resources/search-custom body of POST Request { "searchField": "Title", "searchTerm": "xzy", "exclusionTerms":"Potential" }

I am getting the no content (204)

/lib/search-lib.xqy has this code let $_:= xdmp:log("Inside xquery search custom file") return "this is xquery"

Even the logs are not getting logged in 8011_ErrorLog.txt

So, I am not sure if I am missing anything.

Moreover, how to get the body json params into xquery module to use those in xquery.

Thanks

Mike Gardner
  • 6,611
  • 5
  • 24
  • 34
  • Hi, I would recommend making sure you also use the [marklogic] tag. There are a number of people who keep an eye on that tag, but fewer who look at the specific version tags. – Mike Gardner Dec 16 '20 at 14:23
  • Sure, will do that going forward. But any idea how can we achieve this – Pragya Kapoor Dec 21 '20 at 09:06

0 Answers0