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

Error implementation of docValueCount for SortingSortedSetDocValues

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None
    • New

    Description

      Test failed below:

       

       public void testSortOnAddIndicesOrd() throws IOException {
          Directory tmpDir = newDirectory();
          Directory dir = newDirectory();
          IndexWriterConfig iwc = new IndexWriterConfig(new MockAnalyzer(random()));
          IndexWriter w = new IndexWriter(tmpDir, iwc);
      
          Document doc;
          doc = new Document();
          doc.add(new SortedSetDocValuesField("foo", new BytesRef("b")));
          w.addDocument(doc);
      
          doc.add(new SortedSetDocValuesField("foo", new BytesRef("a")));
          doc.add(new SortedSetDocValuesField("foo", new BytesRef("b")));
          doc.add(new SortedSetDocValuesField("foo", new BytesRef("b")));
          w.addDocument(doc);
      
          w.commit();
      
          Sort indexSort = new Sort(new SortedSetSortField("foo", false, SortedSetSelector.Type.MIN));
          try (DirectoryReader reader = DirectoryReader.open(tmpDir)) {
            for (LeafReaderContext ctx : reader.leaves()) {
              CodecReader wrap =
                      SortingCodecReader.wrap(SlowCodecReaderWrapper.wrap(ctx.reader()), indexSort);
              assertTrue(wrap.toString(), wrap.toString().startsWith("SortingCodecReader("));
              SortingCodecReader sortingCodecReader = (SortingCodecReader) wrap;
              SortedSetDocValues sortedSetDocValues = sortingCodecReader.getDocValuesReader().getSortedSet(ctx.reader().getFieldInfos().fieldInfo("foo"));
              sortedSetDocValues.nextDoc();
              assertEquals(sortedSetDocValues.docValueCount(), 2);
              sortedSetDocValues.nextDoc();
              assertEquals(sortedSetDocValues.docValueCount(), 1);
              assertEquals(sortedSetDocValues.nextDoc(), DocIdSetIterator.NO_MORE_DOCS);
            }
          }
          IOUtils.close(w, dir, tmpDir);
        }
      

       

      Attachments

        Issue Links

          Activity

            People

              ChrisLu Lu Xugang
              ChrisLu Lu Xugang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4h
                  4h