lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Serebrennikov <dmit...@earthlink.net>
Subject Re: IndexWriter.getUseCompoundFile is confusing
Date Sat, 07 Aug 2004 19:38:43 GMT
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.

Regards.
Dmitry.


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


Mime
View raw message