Marklogic cts:element-value-query或条件匹配

时间:2017-01-27 16:13:54

标签: marklogic

doc1.xml

<note>COGNITIVE SCIENCE, EXPERIMENTAL DESIGN</note>

doc2.xml

<note> EXPERIMENTAL DESIGN, AI PROGRAMMING LANGUAGE, JAVA Online</note>

如何构造查询以返回具有条件COGNITIVE SCIENCE“OR”Java Online的文档。我使用cts:element-value-query()但不知道如何添加“OR”条件。

cts:uris(
    (),
    ("descending"),
    cts:and-query((
            cts:collection-query(("/courses")),
            cts:element-value-query(
                                    xs:QName("note"),"COGNITIVE   SCIENCE","case-insensitive")


    ))
)

提前致谢 Thichxai

2 个答案:

答案 0 :(得分:3)

您可以为cts提供短语列表:element-value-query:

cts:element-value-query(xs:QName("note"),("COGNITIVE SCIENCE","Java Online"), "case-insensitive")

答案 1 :(得分:1)

cts:uris(
    (),
    ("descending"),
    cts:and-query((
      cts:collection-query(("/courses")),
      cts:or-query((
        cts:word-query("COGNITIVE SCIENCE","case-insensitive"),
        cts:word-query("Java Online","case-insensitive")
      ))
    ))
)