Search code examples
marklogicmarklogic-9

MarkLogic - Utilize Property Range Index in REST API


How can we make the out-of-the box search APIs (for example, GET V1/search) utilize property range index? I created a custom REST API (GET v1/resources) and coded cts.jsonPropertyRangeQuery to utilize the property range query, but can switch back to non-custom REST APIs (like GET V1/search) and still use property range index?


Solution

  • Yes, you can use JSON property range queries in the out-of-the-box REST API.

    The /v1/search endpoint accepts the JSON or XML serializations of a cts.query or Search API structured query.

    You can see the serialized form of a cts.query by passing it to xdmp.toJSON().

    For more information about structured queries in the Search API, see:

    http://docs.marklogic.com/guide/search-dev/structured-query#id_83393

    Hoping that helps,