< Apache Ant
Motivation
You want a simple ant task that will reindex a collection.
Method
We 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
<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
<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>
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.