I used something like this to list/create indexes:

CollectionManager colman = (CollectionManager) myCollection.getService("CollectionManager", "1.0");
String[] idx = colman.listIndexers();
if (idx.length < 1) {
log.info("initializeXMLDB - Creating indexer");
String document = "<index class='org.apache.xindice.core.indexer.ValueIndexer' name='star_at_star' pattern='[EMAIL PROTECTED]' />";
// optional: type='' pagesize='' maxkeysize=''
colman.createIndexer(DOMParser.toDocument(document));
}
if (log.isDebugEnabled()) {
log.debug("initializeXMLDB - Indexes:\n");
for (int i = 0; i < idx.length; i++) {
log.debug("initializeXMLDB - " + i + " - " + idx[i]);
}
log.debug("initializeXMLDB - Total Indexes: " + idx.length);
}


Hope this helps!

Mario

[EMAIL PROTECTED] wrote:

Does anyone have a code snippet showing how I can programmatically add some indexing, without going through the command-line client?
I didn't see any docs on how to do this, and the javadocs are pretty spartan.


Many thanks.
WH





Reply via email to