xmlxquerymarklogicmarklogic-8marklogic-7

MarkLogic 7 Return Document that have a specific element


the cts:element-value-query in MarkLogic 7 does not work like MarkLogic 8, I would like to return the documents that have an element without attention to its value my query is like:

cts:search(collection("My-Collection"),cts:element-value-query(xs:QName("Element1"), ""))

I would like to return all of the documents that have the Element1 in MarkLogic 7!!??


Solution

  • Try:

    cts:search(
      collection("My-Collection"),
      cts:element-query(xs:QName("Element1"), cts:and-query(()) )
    )
    

    Should work in all MarkLogic versions.

    HTH!