Marklogic API用于获取数据库的reindex状态

嗨,请帮助我使用marklogic API获取数据库的reindex状态.现在我们正在使用这样的东西:

让$forest-reports:=

            let $forest-reports :=
                for $forest-id in xdmp:database-forests($db-id) return
                xdmp:forest-counts($forest-id, "*")

            return 
            fn:sum(
                for $e in $forest-reports//*[fn:contains(fn:local-name(.), "reindex") and fn:contains(fn:local-name(.), "count")] 
                    where xs:integer($e) gt 0 
                    return xs:integer($e)
            )
        return
            if ($forest-reports) then
                <table>
                    <tr>
                        <td><b>Forest</b></td>
                        <td><b>Fragments to Reindex</b></td>
                    </tr>
                {
                <tr><td colspan="2"><b>{$forest-reports}</b></td></tr>

}
                    

但有时这并没有给我们正确的地位.

如果我们遵循正确的方法,请告诉我们.

最佳答案 如何使用
xdmp:forest-status(),例如:

(
  for $forest-id in xdmp:database-forests(xdmp:database())
  return xdmp:forest-status($forest-id)//*:reindexing
) = fn:true()

HTH!

点赞