You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Daniel Naber <da...@t-online.de> on 2004/08/06 12:01:38 UTC

IndexWriter.getUseCompoundFile is confusing

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.

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?

Regards
 Daniel


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


Re: IndexWriter.getUseCompoundFile is confusing

Posted by Christoph Goller <go...@detego-software.de>.
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()

Christoph


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


Re: IndexWriter.getUseCompoundFile is confusing

Posted by Dmitry Serebrennikov <dm...@earthlink.net>.
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