how to use Luke with a pluggable Directory implementation

41 views
Skip to first unread message

ken

unread,
Sep 15, 2011, 7:32:14 PM9/15/11
to Luke - Lucene Index Toolbox
Hi,

I have been using Luke with my own Directory implementation, and
liking it. In order to use my own directory implementation, I first
tried to follow the normal dialog in File->Open Lucene index. Under
"Expert options" it says that I can supply a "full class name".
However, full class names (including the package name) do not work,
even if I put my Directory into the classpath when I launched Luke.
Further inspection in Eclipse Debug menu led me to believe that the
handler code is not actually set up to take input when I manually type
in the fully-qualified class name. Specifically, the lines in
openOk(..):

Object dirImpl = getSelectedItem(find(dialog, "dirImpl"));
String dirClass = null;
if (dirImpl == null) {
dirClass = FSDirectory.class.getName();
} else {
String name = getString(dirImpl, "name");
if (name == null) {
dirClass = getString(dirImpl, "text");
} else {
if (name.equals("fs")) {

do not do the right thing, the dirClass does not become the text value
I typed ub. I ended up editing lukeinit.xml by adding
<choice font="10" name="foo"
text="com.foo.FooDirectory"/>
and editing Luke.java openOk(..) adding
} else if (name.equals("foo")) {
dirClass = getString(dirImpl, "text");
after the "fs"-handler, and this seemed to work. So everything works,
but this is obviously not the right way to accomplish my goal.

My question is three-fold:
1. Is anyone actually using a truly pluggable Directory
implementation?
2. If so, how?
3. If not, what is the desired way for me to patch Luke for my use
case? I am thinking the simplest thing is to just add an extra text
field outside of the drop-down under Expert where I can fill in my
fully-qualitified-class name, and then write code in Luke.java to
handle it. Would this approach be acceptable to committers?

I am on MacOS X with java 1.6 and luke/lucene 3.3.

Thanks,
-Ken
Reply all
Reply to author
Forward
0 new messages