4

嗨,请帮助我使用 marklogic API 获取数据库的重新索引状态。现在我们正在使用这样的东西: let $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>

}

但有时这并没有给我们正确的状态。

请让我们知道我们是否遵循正确的方法。

4

1 回答 1

2

使用xdmp:forest-status()怎么样,例如:

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

于 2015-03-24T16:03:12.297 回答