[ https://issues.apache.org/jira/browse/LUCENE-767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12463322 ]
Chuck Williams commented on LUCENE-767: --------------------------------------- Isn't maxDoc always the same as the docCount of the segment, which is stored? I.e., couldn't SegmentReader.maxDoc() be equivalently defined as: public int maxDoc() { return si.docCount; } Since maxDoc==numDocs==docCount for a newly merged segment, and deletion with a reader never changes numDocs or maxDoc, it seems to me these values should always be the same. All Lucene tests pass with this definition. I have code that relies on this equivalence and so would appreciate knowledge of any case where this equivalence might not hold. > maxDoc should be explicitly stored in the index, not derived from file length > ----------------------------------------------------------------------------- > > Key: LUCENE-767 > URL: https://issues.apache.org/jira/browse/LUCENE-767 > Project: Lucene - Java > Issue Type: Improvement > Affects Versions: 1.9, 2.0.0, 2.0.1, 2.1 > Reporter: Michael McCandless > Assigned To: Michael McCandless > Priority: Minor > > This is a spinoff of LUCENE-140 > In general we should rely on "as little as possible" from the file system. > Right now, maxDoc is derived by checking the file length of the FieldsReader > index file (.fdx) which makes me nervous. I think we should explicitly store > it instead. > Note that there are no known cases where this is actually causing a problem. > There was some speculation in the discussion of LUCENE-140 that it could be > one of the possible, but in digging / discussion there were no specifically > relevant JVM bugs found (yet!). So this would be a defensive fix at this > point. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]