Quoting Andrzej Bialecki <[EMAIL PROTECTED]>: > Regarding Luke - actually, it would not be so difficult to implement > this (at least for me ;-) ). Save for some minor exceptions, Luke opens > an IndexReader once, and I could add another version of the Open dialog > to use open multiple indexes. > > (I can't promise, however, to do it quickly - I'm finalizing a couple of > projects now, so this has to wait a bit...)
No worries, I figured it out. You see, I have already written the following two methods that would recursively search a base directory for lucene indexes, and then automatically return either an IndexSearcher or MultiSearcher depending on how many indexes were found. I just need to make a pair of similar methods for creating Readers and I'm done. public Searcher getSearcher(String path) throws IOException { ArrayList searchers = getSearcherImpl(new File(path), new ArrayList()); if (searchers.size() == 0) return null; else if (searchers.size() == 1) return (Searcher)searchers.get(0); else { Searcher array[] = new Searcher[searchers.size()]; System.out.println("Creating MultiSearcher (" + array.length + ")"); array = (Searcher[])searchers.toArray(array); return new MultiSearcher(array); } } protected ArrayList getSearcherImpl(File file, ArrayList searchers) throws IOException { if (file.isDirectory()) { File files[] = file.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { searchers = getSearcherImpl(files[i], searchers); } else if (files[i].getName().equalsIgnoreCase("segments")) { System.out.println("Index Found: " + file.getPath()); searchers.add(new IndexSearcher(file.getPath())); } } } return searchers; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]