sw.start();
SearchEngineIndexer indexer = new SearchEngineIndexer(context, searchEngine, connectionFactory);
indexer.indexAllWorkspaces();
indexer.close();
sw.stop();
Duration zeroth = sw.getTotalDuration();
System.out.println("Time to prime search engine: " + zeroth);
// First load the content into the unsearched source ...
sw.reset();
sw.start();
loadContent(unsearchedContent);
sw.stop();
Duration first = sw.getTotalDuration();
// Now load the same content into the searchable source ...
sw.reset();
sw.start();
loadContent(content);
sw.stop();
Duration second = sw.getTotalDuration();
// And measure the time required to re-index ...
sw.reset();
sw.start();
indexer = new SearchEngineIndexer(context, searchEngine, connectionFactory);
indexer.indexAllWorkspaces();
indexer.close();
sw.stop();
Duration third = sw.getTotalDuration();
int percentOfLoading = (int)(((second.floatValue() / first.floatValue())) * 100.0f);
System.out.println("Time to load content without indexing: " + first);
System.out.println("Time to load content and updating indexes: " + second + " (" + percentOfLoading
+ "% of loading w/o indexing)");
Duration loadingDiff = second.subtract(first);
System.out.println("Time to update indexes during loading: " + loadingDiff);
int percentChange = (int)((((third.floatValue() - loadingDiff.floatValue()) / loadingDiff.floatValue())) * 100.0f);
if (percentChange >= 0) {
System.out.println("Time to re-index all content: " + third + " (" + percentChange
+ "% more than indexing time during loading)");
} else {
System.out.println("Time to re-index all content: " + third + " (" + percentChange