如何在文档属性中搜索?

Pun*_*ant 5 marklogic

我想搜索文档的文档属性.我只有Marklogic中加载的文档,没有xml文件.我已经关闭了内容处理.现在我想搜索元数据(存在xdmp:document-properties(uri))

我在文档中有以下属性: -

<?xml version="1.0" encoding="UTF-8"?>
<prop:properties xmlns:prop="http://marklogic.com/xdmp/property">
  <uploaded>true</uploaded>
  <OntologyResourceTypeValue>DOCUMENT</OntologyResourceTypeValue>
  <content-type>application/pdf</content-type>
  <filter-capabilities>text subfiles HD-HTML</filter-capabilities>
  <CreationDate>2002/12/05 09:44:29Z</CreationDate>
  <ModDate>2002/12/05 12:02:27+02'00'</ModDate>
  <Producer>Acrobat Distiller 5.0 (Windows)</Producer>
  <Author>Administrator</Author>
  <Creator>PScript5.dll Version 5.2</Creator>
</prop:properties>
Run Code Online (Sandbox Code Playgroud)

现在我想搜索作者而不是其他属性.如果我正在使用search:search("Administrator")那么它正在整个文档中寻找这个词.但是,我想只搜索文档属性中的Author标记.同样,我也希望在其他属性中搜索.

我也试过这个: -

let $options := <options xmlns="http://marklogic.com/appservices/search">
                          <constraint name="author">
                        <properties name="prop:Author"/>
                      </constraint>
                  </options>
    let $results := search:search("author:Administrator", $options, 1,  10)
    return  
    $results
Run Code Online (Sandbox Code Playgroud)

但是,这不起作用.请帮忙.

mbl*_*ele 0

我相信您还需要设置可搜索的表达式。尝试添加此选项:

<searchable-expression>xdmp:document-properties()</searchable-expression>
Run Code Online (Sandbox Code Playgroud)