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

Class Field levelN is not populated correctly in QuadPrefixTree

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 4.0, 5.0, 6.0, 7.0, 8.0
    • 8.3
    • modules/spatial-extras
    • New

    Description

      QuadPrefixTree in Lucene prepopulates these arrays:

      levelW = new double[maxLevels];
      levelH = new double[maxLevels];
      levelS = new int[maxLevels];
      levelN = new int[maxLevels];

      Like this

      for (int i = 1; i < levelW.length; i++) {
      {{ levelW[i] = levelW[i - 1] / 2.0;}}
      {{ levelH[i] = levelH[i - 1] / 2.0;}}
      {{ levelS[i] = levelS[i - 1] * 2;}}
      {{ levelN[i] = levelN[i - 1] * 4;}}
      }

      The field

      levelN[]

      overflows after level 14 = 1073741824 where maxLevels is limited to 

      MAX_LEVELS_POSSIBLE = 50;

      The field levelN appears not to be used anywhere. Likewise, the field

      {{levelS[] }}

      is only used in the 

      printInfo

      method. I would propose either to remove both 

      levelN[],levelS[]

      or to change the datatype

      levelN = new long[maxLevels];

      Attachments

        1. LUCENE-8758.patch
          2 kB
          Amish Shah

        Activity

          People

            dsmiley David Smiley
            djptek Dominic Page
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: