lc command is unable to construct OakDirectory
@@ -22,8 +22,8 @@ package org.apache.jackrabbit.oak.console.commands
import com.google.common.base.Stopwatch
import org.apache.jackrabbit.oak.commons.PathUtils
import org.apache.jackrabbit.oak.console.ConsoleSession
+import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexDefinition
import org.apache.jackrabbit.oak.plugins.index.lucene.directory.OakDirectory
-import org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition
import org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants
import org.apache.jackrabbit.oak.spi.commit.CommitInfo
import org.apache.jackrabbit.oak.spi.commit.EmptyHook
@@ -129,7 +129,7 @@ class LuceneCommand extends ComplexCommandSupport {
//OakDirectory is package scope but Groovy allows us
//to use it. Good or bad but its helpful debug scripts
//can access inner classes and prod code cannot. Win win :)
- return new OakDirectory(new ReadOnlyBuilder(definition), new IndexDefinition(session.root, definition, path), true);
+ return new OakDirectory(new ReadOnlyBuilder(definition), new LuceneIndexDefinition(session.root, definition, path), true);
}
return null
}
@@ -143,9 +143,13 @@ class LuceneCommand extends ComplexCommandSupport {
return ""
}
int exp = (int) (Math.log(bytes) / Math.log(1024));
+ if (exp == 0) {
+ return String.format("%d bytes", bytes);
+ } else {
String pre = "KMGTPE".charAt(exp - 1);
return String.format("%.1f %sB", bytes / Math.pow(1024, exp), pre);
}
+ }
private ConsoleSession getSession(){
return (ConsoleSession)variables.session
