Apache Ant/Reindex a Collection
Motivation
editYou want a simple ant task that will reindex a collection.
Method
editWe will us the ant task that will call an XQuery that has the reindex() command in it. Because there is no ant task that does this we will use the xquery task to execute a remote XQuery that performs this task.
Here is a link to the ant task to run an XQuery http://exist-db.org/ant-tasks.html#N1041F
Call a remote XQuery by file name
edit<target name="reindex-collection">
<xdb:xquery user="${user}" password="${password}"
uri="${test-server}$(collection)" query="reindex.xq"
outputproperty="result">
</xdb:xquery>
<echo message="Result = ${result}"/>
</target>
Supply the Body of an XQuery
edit<target name="inline-query">
<xdb:xquery uri="${test-server}/db"
user="${user}" password="${password}"
outputproperty="result">
reindex('/db/mycollection')
</xdb:xquery>
<!-- note, this only returns a SINGLE line -->
<echo message="Result = ${result}"/>
</target>