lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <li...@ehatchersolutions.com>
Subject Re: access denied to indexDir/segments
Date Fri, 18 Jul 2003 18:06:19 GMT
On Friday, July 18, 2003, at 01:35  PM, Raible, Matt wrote:
> 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: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message