Skip to content

Commit

Permalink
OAK-8597: lc command is unable to construct OakDirectory
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1866457 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
catholicon committed Sep 5, 2019
1 parent 286a898 commit 0710b21
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -143,8 +143,12 @@ class LuceneCommand extends ComplexCommandSupport {
return ""
}
int exp = (int) (Math.log(bytes) / Math.log(1024));
String pre = "KMGTPE".charAt(exp - 1);
return String.format("%.1f %sB", bytes / Math.pow(1024, exp), pre);
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(){
Expand Down

0 comments on commit 0710b21

Please sign in to comment.