Marklogic - 如何找到任何记录没有字段

Marklogic - how find any record doesn't has a field

我有一些 XML 在集合中缺少 citationDate 字段元素。

如何查找没有 citationDate 字段元素的任何记录(集合中的文档)。如何构建查询?

let $uris := cts:uris(
                     (),
                     (),
                     cts:collection-query
                         (("/collection/research","/collection/IACS")
                      and DONT have citationDate field
                  )
return count($uris)

我认为您正在寻找与元素查询相结合的非查询:

cts:not-query(cts:element-query(xs:QName("citationDate"), cts:true-query()))

您可以使用 cts:and-query.

将其与您的集合查询结合起来

HTH!