Yes, I would use this, especially the IndexReader methods that you
suggested.

Otis

--- Doug Cutting <[EMAIL PROTECTED]> wrote:
> > From: Otis Gospodnetic [mailto:[EMAIL PROTECTED]]
> > 
> > You could try looking for a segments file in the index directory.
> > If it exists, the index exists, else it does not.
> > 
> > Is there a better way?
> 
> I think that's currently the best way.  But it's not great, because
> it
> requires applications to know something about the internal structure
> of the
> index.
> 
> Going forward, I'm hesitant to change the semantics of the 'create'
> flag.
> I'm also hesitant to add another flag or constructor method.
> 
> Perhaps the addition of the following IndexReader methods would
> suffice:
> 
>   /** Returns true iff an index exists in the named directory. */
>   public static boolean indexExists(String directory);
>   public static boolean indexExists(File directory);
>   public static boolean indexExists(Directory directory);
> 
> These are analogous to the 'lastModified' methods. Internally these
> would
> just check for the existence of the segments file.
> 
> Does that sound like a good plan?
> 
> Another place that currently requires application knowledge of index
> structure is failure recovery.  Currently if an indexing application
> crashes
> it may leave .lock files in the directory which must be removed
> before the
> index can be altered again.  Perhaps this can be resolved similarly
> by
> adding methods like:
> 
>   /** Returns true iff the index in the named directory is currently
> locked.*/
>   public static boolean isLocked(Directory directory);
> 
>   /** Forcibly unlocks the index in the named directory. 
>    * Caution: this should only be used by failure recovery code,
>    * when it is known that no other process or thread is in fact
>    * currently accessing this index.
>    */
>   public static void unlock(Directory directory);
> 
> We could also have String and File versions for convenience.
> 
> Would folks use something like this?  If so, more fodder for the TODO
> list!
> 
> Doug
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to