[ https://issues.apache.org/jira/browse/LUCENE-9416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17164487#comment-17164487 ]
Michael McCandless commented on LUCENE-9416: -------------------------------------------- Hi [~mosadiq] this is indeed tricky to test. Since {{CheckIndex}} works from a {{Directory}} you must indeed create an index that has negative norms in it, for at least one document that has no terms. It might be simplest to make a custom {{BrokenNormsFormat}} and use that in your own custom {{MockCodec}}? Then, your {{NormsProducer}} could produce a negative norms value (for an indexed {{Document}} that had no terms in it)? Alternatively, you could make your own {{FilterLeafReader}} that overrides {{getNormValues}} to return a mock {{NumericDocValues}} that returns negative values, then use {{IndexWriter.addIndexes}} to add that reader into another index, then run {{CheckIndex}} on that index? Also, see {{TestUtil.checkIndex}} for some helper APIs to invoke {{CheckIndex}} and collect its output. Or, maybe we do not bother with a unit test here? This is a String message, included in an exception, printed to the console typically by default, for human consumption. We do not have such strong unit tests checking most other Lucene exception messages ... progress not perfection? > Fix CheckIndex to print norms as unsigned integers > -------------------------------------------------- > > Key: LUCENE-9416 > URL: https://issues.apache.org/jira/browse/LUCENE-9416 > Project: Lucene - Core > Issue Type: Bug > Components: core/index > Reporter: Mohammad Sadiq > Priority: Minor > Attachments: LUCENE-9416.patch > > > In the [discussion on "CheckIndex complaining about -1 for norms value" in > the java-user list|http://markmail.org/message/gcwdhasblsyovwc2], it was > identified that we should "fix CheckIndex to print norms as unsigned > integers". > I'd like to take a stab at this. > I'm trying to understand the problem and from what I gather, while norms are > `byte`s, the API exposes them as `long` values. While printing the error > message, we want it to print a zero instead of -1? -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org