MarkLogic 7 Return Document that have a specific element

77 Views Asked by At

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!!??

1

There are 1 best solutions below

0
On BEST ANSWER

Try:

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

Should work in all MarkLogic versions.

HTH!