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

StraightBytesDocValuesField fails if bytes > 32k

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 4.0, 4.1, 6.0
    • 4.5, 6.0
    • core/index
    • None
    • New

    Description

      I didn't observe any limitations on the size of a bytes based DocValues field value in the docs. It appears that the limit is 32k, although I didn't get any friendly error telling me that was the limit. 32k is kind of small IMO; I suspect this limit is unintended and as such is a bug. The following test fails:

        public void testBigDocValue() throws IOException {
          Directory dir = newDirectory();
          IndexWriter writer = new IndexWriter(dir, writerConfig(false));
      
          Document doc = new Document();
          BytesRef bytes = new BytesRef((4+4)*4097);//4096 works
          bytes.length = bytes.bytes.length;//byte data doesn't matter
          doc.add(new StraightBytesDocValuesField("dvField", bytes));
          writer.addDocument(doc);
          writer.commit();
          writer.close();
      
          DirectoryReader reader = DirectoryReader.open(dir);
          DocValues docValues = MultiDocValues.getDocValues(reader, "dvField");
          //FAILS IF BYTES IS BIG!
          docValues.getSource().getBytes(0, bytes);
      
          reader.close();
          dir.close();
        }
      

      Attachments

        1. LUCENE-4583.patch
          39 kB
          Michael McCandless
        2. LUCENE-4583.patch
          39 kB
          Michael McCandless
        3. LUCENE-4583.patch
          41 kB
          Michael McCandless
        4. LUCENE-4583.patch
          31 kB
          Michael McCandless
        5. LUCENE-4583.patch
          23 kB
          Michael McCandless
        6. LUCENE-4583.patch
          9 kB
          Michael McCandless
        7. LUCENE-4583.patch
          3 kB
          Barakat Barakat
        8. LUCENE-4583.patch
          5 kB
          Barakat Barakat

        Activity

          People

            mikemccand Michael McCandless
            dsmiley David Smiley
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: