Search code examples
restxsltmarklogic

Custom Search Results in REST MarkLogic


So new to MarkLogic am stuck and not finding the documentation of use. I know what i need to do, just do not know how to do it.

I have a keyvalue? search on my REST server which returns ML's standard search results and XML snippet. I want to create my own custom search result which will output a title element for my XML files.

I am aware that i need to create an XSLT transformation document and upload that to the server but do not know how to target ML's search function or how to write this out.

I have basic knowledge of XSLT, if i just created something that targets each files title using xPath will this work, or does ML require use of their custom functions?

I know its a bit broad, but hopefully someone can point steer me.


Solution

  • Sounds like you are talking about the GET /v1/keyvalue endpoint of MarkLogic REST API. Unfortunately that does not allow you to choose a transform. You can probably use GET /v1/search with a transform param instead though, using a structured query for an element value query. The docs contain a good syntax reference on that.

    Docs on creating and managing transforms can be found here:

    http://docs.marklogic.com/guide/rest-dev/transforms#chapter

    HTH!