XQuery/Reindex a Collection

Motivation
You would like a command line function that will reindex a collection.

Method
We will use an Apache Ant task that will call an XQuery script that will run the reindex XQuery function.

Running your Ant Target
To run the command just use the ant command

$ant reindex-faqs

Buildfile: build.xml reindex-faqs: [echo] Reindexing collection /db/dan/apps/faqs/data [echo] test server = xmldb:exist://localhost/xmlrpc [xdb:xquery] Database driver registered. [xdb:xquery] Found 1 results [echo] Reindex performed in = 203 milliseconds. BUILD SUCCESSFUL Total time: 1 second

Discussion
This should work both under Windows and UNIX systems.