Marklogic API for reindex Database Status

Hi, please help me in getting reindex database status using marklogic API. Now we use something like this: 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>

}                   

But sometimes this does not give us the right status.

Please tell us if we will follow the right path or not.

+4
source share
1 answer

How about using xdmp: forest-status () , for example:

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

NTN!

+2
source

All Articles