lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Goller <>
Subject Re: IndexWriter.getUseCompoundFile is confusing
Date Sun, 08 Aug 2004 12:40:29 GMT
Dmitry Serebrennikov wrote:
> Daniel Naber wrote:
>> Hi,
>> I open an index with create=false so I can use addIndexes() on that 
>> index. I want to use the existing setting for useCompoundFile of that 
>> index. But getUseCompoundFile() will always return true, as it just 
>> returns what one has set with setUseCompoundFile() or the default.
> Hi Daniel,
> This setting really controls what should happen when new merge occur, 
> not what has happened in the index in the past... But perhaps there 
> should be a way to find out what format a given index uses as well? For 
> optimized indexes, this would be unumbigious, and for multi-segment 
> indexes, perhaps it would be enough to ask if at least one segment uses 
> compound files or if at least one segment uses multi-file format?
> Actually, there is already a method on SegmentReader called 
> usesCompoundFile() which will return a boolean about that segment. There 
> is also a static method there that takes a SegmentInfo object. Perhaps 
> IndexWriter's value should be initialized to true only if create is true 
> or if at least one existing segment already uses compound files? Would 
> that help?
>> I suggest to just remove getUseCompoundFile(). Asking for a value 
>> which one set just before with setUseCompoundFile() doesn't make much 
>> sense, and asking for the default also doesn't make much sense either 
>> I think. Any opinions/objections?
> Well, I think from the design and testability point of view, any setter 
> should have a corresponding getter. In other words, if you can do 
> something to an object from the outside, you should be able to verify 
> that it has been done. Perhaps we need to change the initialization 
> behavior, but I think the method should stay.

I also think that there should be a getter and a setter. However, the
JavaDoc could be improved to make clear that useCompoundFile does not
give information about the current property of the index, but determines
behavior of the writer and thus future propertis of the index.

We could add public methods to IndexReader which give information about
the index such as:
boolean usesCompoundFile(): true only if all segments use compound files
boolean hasChangedNorms()
boolean isOptimized()


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message