I'm planning on having different index directories for each user, in the
format indexDir/username. This will allow a single site to be indexed, or I
can loop through all the users and index them all. We're going to leave up
the "indexing" to the site admin, and there will be buttons (on a JSP) that
allow indexing of individual sites, or all sites. Does this sound
reasonable?
Yup, seems fine.
// throw an error if no index exists
if (!IndexReader.indexExists(mIndexDir)) {
throw new IndexNotCreatedException("No index directory
exists at: "
+
mIndexDir);
}
Well, the implementation is this:
public static boolean indexExists(File directory) { return (new File(directory, "segments")).exists(); }
Is this the proper way to test for an index, or should I just use:
File dirPath = new File(indexDir); if (!dirPath.exists()) { throw new IndexNotCreatedException("No index directory exists at: " + mIndexDir); }
Which is about the same as above. I'd stick with the IndexReader.indexExists method just to let Lucene hide the details.
Also, when create an index, do I need to create the directory
index/username, or will "new IndexWriter(indexPath, null, true)" do this for
me?
It will create it for you.
Erik
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
