You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Bernhard Messer <Be...@intrafind.de> on 2004/08/06 05:04:35 UTC

IndexReader and TermVectorsWriter cleanup

Hi developers,

in the attachments you will find to small cleanups for IndexReader and 
TermVectorsWriter. In TermVectorsWriter, the visibility of some public 
members are changed to protected.

In IndexReader, there is a public method "directory()", where classes 
outside lucene can get the current directory object attached to this 
reader. I think it would be better to make the method protected, so that 
no classes outside this package can fetch the directory object from an 
existing reader and maybe even close the directory which would definitly 
damage the reader.

best regards
Bernhard




Re: IndexReader and TermVectorsWriter cleanup

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Bernhard,

Since IndexReader was a public method, some people may be relying on
it.
Also, since one needs to pass Directory to IndexReader's
open(Directory) method, the caller already has a Directory reference
that they can mess with.
 
As for changing those public class variables to protected - do we
really gain much, or anything by making them protected, since they are
already static and final?

I feel like leaving these two classes as they are now.

Otis

--- Bernhard Messer <Be...@intrafind.de> wrote:

> Hi developers,
> 
> in the attachments you will find to small cleanups for IndexReader
> and 
> TermVectorsWriter. In TermVectorsWriter, the visibility of some
> public 
> members are changed to protected.
> 
> In IndexReader, there is a public method "directory()", where classes
> 
> outside lucene can get the current directory object attached to this 
> reader. I think it would be better to make the method protected, so
> that 
> no classes outside this package can fetch the directory object from
> an 
> existing reader and maybe even close the directory which would
> definitly 
> damage the reader.
> 
> best regards
> Bernhard
> 
> 
> 
> > Index: src/java/org/apache/lucene/index/IndexReader.java
> ===================================================================
> RCS file:
>
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/index/IndexReader.java,v
> retrieving revision 1.33
> diff -r1.33 IndexReader.java
> 131c131
> <   public Directory directory() { return directory; }
> ---
> >   protected Directory directory() { return directory; }
> > Index: src/java/org/apache/lucene/index/TermVectorsWriter.java
> ===================================================================
> RCS file:
>
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/index/TermVectorsWriter.java,v
> retrieving revision 1.1
> diff -r1.1 TermVectorsWriter.java
> 34c34
> <   public static final int FORMAT_VERSION = 1;
> ---
> >   protected static final int FORMAT_VERSION = 1;
> 36c36
> <   public static final int FORMAT_SIZE = 4;
> ---
> >   protected static final int FORMAT_SIZE = 4;
> 39,41c39,41
> <   public static final String TVX_EXTENSION = ".tvx";
> <   public static final String TVD_EXTENSION = ".tvd";
> <   public static final String TVF_EXTENSION = ".tvf";
> ---
> >   protected static final String TVX_EXTENSION = ".tvx";
> >   protected static final String TVD_EXTENSION = ".tvd";
> >   protected static final String TVF_EXTENSION = ".tvf";
> 
> >
---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org