getLogger().debug("use luceneIndexTransformer with indexer component");
// lookup the indexer
try {
indexer = (Indexer) this.manager.lookup(Indexer.ROLE+"/default");
} catch (ServiceException e) {
throw new IndexException(e);
}
File indexDirectory = new File(queryConfiguration.indexDirectory);
if (!indexDirectory.isAbsolute()) {
indexDirectory = new File(workDir,
queryConfiguration.indexDirectory);
}
// If the index directory doesn't exist, then always create it.
boolean indexExists = IndexReader.indexExists(indexDirectory);
if (!indexExists) {
createIndex = true;
}
// Get the index directory, creating it if necessary
try {
Directory directory = LuceneCocoonHelper.getDirectory(
indexDirectory, createIndex);
indexer.setIndex(directory);
} catch (IOException e) {
throw new IndexException("set directory " + indexDirectory
+ " error", e);
}
// Get the analyzer
Analyzer analyzer = LuceneCocoonHelper
.getAnalyzer(queryConfiguration.analyzerClassname);