Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-8077

Integer remainder modulo 1 problem in /core/src/java/org/apache/lucene/index/CheckIndex.java

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.1
    • Fix Version/s: 7.3, 8.0
    • Component/s: core/index
    • Labels:
    • Lucene Fields:
      New

      Description

      At /core/src/java/org/apache/lucene/index/CheckIndex.java: 2198
      The branch condition :

      (i % 1 == 0)
      

      is always true.
      Did you mean (exp & 1) or (exp % 2) instead?

      The related code is show below:

      2198:        if (i % 1 == 0) {
                int doc2 = it2.nextDoc();
                if (doc != doc2) {
                  throw new RuntimeException("dv iterator field=" + field + ": doc=" + doc + " was not found through advance() (got: " + doc2 + ")");
                }
                if (it2.docID() != doc) {
                  throw new RuntimeException("dv iterator field=" + field + ": doc=" + doc + " reports wrong doc ID (got: " + it2.docID() + ")");
                }
              }
            }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bingosxs Xiaoshan Sun
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1m
                1m
                Remaining:
                Remaining Estimate - 1m
                1m
                Logged:
                Time Spent - Not Specified
                Not Specified