Package org.apache.lucene.util

Examples of org.apache.lucene.util.Bits$MatchAllBits


      IndexReader reader = DirectoryReader.open(dir);
      int expected = (3+(1-i)*2)*NUM_THREAD*NUM_ITER;
      assertEquals("i=" + i, expected, reader.docFreq(new Term("contents", "here")));
      assertEquals(expected, reader.maxDoc());
      int numDel = 0;
      final Bits liveDocs = MultiFields.getLiveDocs(reader);
      assertNotNull(liveDocs);
      for(int j=0;j<reader.maxDoc();j++) {
        if (!liveDocs.get(j))
          numDel++;
        else {
          reader.document(j);
          reader.getTermVectors(j);
        }
View Full Code Here


        r = w.getReader();
      }
      assertEquals(docCount-deleteCount, r.numDocs());
      if (defaultCodecSupportsDocValues()) {
        for (AtomicReaderContext context : r.leaves()) {
          Bits liveDocs = context.reader().getLiveDocs();
          NumericDocValues f = context.reader().getNumericDocValues("f");
          NumericDocValues cf = context.reader().getNumericDocValues("cf");
          for (int i = 0; i < context.reader().maxDoc(); i++) {
            if (liveDocs == null || liveDocs.get(i)) {
              assertEquals("doc=" + (docBase + i), cf.get(i), f.get(i) * 2);
            }
          }
        }
      }
View Full Code Here

      writer.close();
    }
   
    AtomicReader slow = SlowCompositeReaderWrapper.wrap(reader);
   
    Bits liveDocs = slow.getLiveDocs();
    boolean[] expectedLiveDocs = new boolean[] { true, false, false, true, true, true };
    for (int i = 0; i < expectedLiveDocs.length; i++) {
      assertEquals(expectedLiveDocs[i], liveDocs.get(i));
    }
   
    long[] expectedValues = new long[] { 1, 2, 3, 17, 5, 17};
    NumericDocValues ndv = slow.getNumericDocValues("val");
    for (int i = 0; i < expectedValues.length; i++) {
View Full Code Here

      } else {
        assertEquals(5, ndv.get(i));
      }
    }
   
    Bits docsWithField = r.getDocsWithField("ndv");
    assertFalse(docsWithField.get(0));
    assertTrue(docsWithField.get(1));
   
    reader.close();
    dir.close();
  }
View Full Code Here

    NumericDocValues ndv = r.getNumericDocValues("ndv");
    for (int i = 0; i < r.maxDoc(); i++) {
      assertEquals(0, ndv.get(i));
    }
   
    Bits docsWithField = r.getDocsWithField("ndv");
    assertFalse(docsWithField.get(0));
    assertFalse(docsWithField.get(1));
   
    reader.close();
    dir.close();
  }
View Full Code Here

//      System.out.println("[" + Thread.currentThread().getName() + "]: reopened reader: " + reader);
      assertTrue(reader.numDocs() > 0); // we delete at most one document per round
      for (AtomicReaderContext context : reader.leaves()) {
        AtomicReader r = context.reader();
//        System.out.println(((SegmentReader) r).getSegmentName());
        Bits liveDocs = r.getLiveDocs();
        for (int field = 0; field < fieldValues.length; field++) {
          String f = "f" + field;
          NumericDocValues ndv = r.getNumericDocValues(f);
          Bits docsWithField = r.getDocsWithField(f);
          assertNotNull(ndv);
          int maxDoc = r.maxDoc();
          for (int doc = 0; doc < maxDoc; doc++) {
            if (liveDocs == null || liveDocs.get(doc)) {
//              System.out.println("doc=" + (doc + context.docBase) + " f='" + f + "' vslue=" + ndv.get(doc));
              if (fieldHasValue[field]) {
                assertTrue(docsWithField.get(doc));
                assertEquals("invalid value for doc=" + doc + ", field=" + f + ", reader=" + r, fieldValues[field], ndv.get(doc));
              } else {
                assertFalse(docsWithField.get(doc));
              }
            }
          }
        }
      }
View Full Code Here

    DirectoryReader reader = DirectoryReader.open(dir);
    for (AtomicReaderContext context : reader.leaves()) {
      AtomicReader r = context.reader();
      NumericDocValues ndv = r.getNumericDocValues("ndv");
      Bits docsWithField = r.getDocsWithField("ndv");
      assertNotNull(docsWithField);
      assertTrue(docsWithField.get(0));
      assertEquals(5L, ndv.get(0));
      assertFalse(docsWithField.get(1));
      assertEquals(0L, ndv.get(1));
    }
    reader.close();

    dir.close();
View Full Code Here

    for (AtomicReaderContext context : reader.leaves()) {
      AtomicReader r = context.reader();
      for (int i = 0; i < numThreads; i++) {
        NumericDocValues ndv = r.getNumericDocValues("f" + i);
        NumericDocValues control = r.getNumericDocValues("cf" + i);
        Bits docsWithNdv = r.getDocsWithField("f" + i);
        Bits docsWithControl = r.getDocsWithField("cf" + i);
        Bits liveDocs = r.getLiveDocs();
        for (int j = 0; j < r.maxDoc(); j++) {
          if (liveDocs == null || liveDocs.get(j)) {
            assertEquals(docsWithNdv.get(j), docsWithControl.get(j));
            if (docsWithNdv.get(j)) {
              assertEquals(control.get(j), ndv.get(j) * 2);
            }
          }
View Full Code Here

      }
      if (!r.hasDeletions()) { // skip all docs that belong to this reader as it has no deletions
        while ((doc = it.nextDoc()) < maxDoc) {}
        continue;
      }
      Bits liveDocs = r.getLiveDocs();
      do {
        if (!liveDocs.get(doc - context.docBase)) {
          set.clear(doc);
        }
      } while ((doc = it.nextDoc()) < maxDoc);
    }
  }
View Full Code Here

    _TestUtil.checkIndex(dir);
   
    // true if this is a 4.0+ index
    final boolean is40Index = MultiFields.getMergedFieldInfos(reader).fieldInfo("content5") != null;

    final Bits liveDocs = MultiFields.getLiveDocs(reader);

    for(int i=0;i<35;i++) {
      if (liveDocs.get(i)) {
        Document d = reader.document(i);
        List<IndexableField> fields = d.getFields();
        boolean isProxDoc = d.getField("content3") == null;
        if (isProxDoc) {
          final int numFields = is40Index ? 7 : 5;
View Full Code Here

TOP

Related Classes of org.apache.lucene.util.Bits$MatchAllBits

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.