[DS-2060] Extended SOLR commit duration due to SpellCheckComponent ("Did you mean")

This commit is contained in:
KevinVdV
2014-07-10 13:42:00 +02:00
parent 4e2780ce50
commit d5716e56d1
4 changed files with 42 additions and 1 deletions

View File

@@ -66,6 +66,10 @@ public class IndexClient {
"(re)build index, wiping out current one if it exists").create(
"b"));
options.addOption(OptionBuilder.isRequired(false).withDescription(
"Rebuild the spellchecker, can be combined with -b and -f.").create(
"s"));
options
.addOption(OptionBuilder
.isRequired(false)
@@ -111,15 +115,32 @@ public class IndexClient {
} else if (line.hasOption("b")) {
log.info("(Re)building index from scratch.");
indexer.createIndex(context);
checkRebuildSpellCheck(line, indexer);
} else if (line.hasOption("o")) {
log.info("Optimizing search core.");
indexer.optimize();
} else if(line.hasOption('s')) {
checkRebuildSpellCheck(line, indexer);
} else {
log.info("Updating and Cleaning Index");
indexer.cleanIndex(line.hasOption("f"));
indexer.updateIndex(context, line.hasOption("f"));
checkRebuildSpellCheck(line, indexer);
}
log.info("Done with indexing");
}
/**
* Check the command line options and rebuild the spell check if active.
* @param line the command line options
* @param indexer the solr indexer
* @throws SearchServiceException in case of a solr exception
*/
protected static void checkRebuildSpellCheck(CommandLine line, IndexingService indexer) throws SearchServiceException {
if (line.hasOption("s")) {
log.info("Rebuilding spell checker.");
indexer.buildSpellCheck();
}
}
}