Java 类org.apache.lucene.index.CheckIndex.Status.DocValuesStatus 实例源码

项目:NYBC    文件:_TestUtil.java   
public static void checkReader(AtomicReader reader, boolean crossCheckTermVectors) throws IOException {
  ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
  PrintStream infoStream = new PrintStream(bos, false, "UTF-8");

  FieldNormStatus fieldNormStatus = CheckIndex.testFieldNorms(reader, infoStream);
  TermIndexStatus termIndexStatus = CheckIndex.testPostings(reader, infoStream);
  StoredFieldStatus storedFieldStatus = CheckIndex.testStoredFields(reader, infoStream);
  TermVectorStatus termVectorStatus = CheckIndex.testTermVectors(reader, infoStream, false, crossCheckTermVectors);
  DocValuesStatus docValuesStatus = CheckIndex.testDocValues(reader, infoStream);

  if (fieldNormStatus.error != null || 
    termIndexStatus.error != null ||
    storedFieldStatus.error != null ||
    termVectorStatus.error != null ||
    docValuesStatus.error != null) {
    System.out.println("CheckReader failed");
    System.out.println(bos.toString("UTF-8"));
    throw new RuntimeException("CheckReader failed");
  } else {
    if (LuceneTestCase.INFOSTREAM) {
      System.out.println(bos.toString("UTF-8"));
    }
  }
}
项目:Maskana-Gestor-de-Conocimiento    文件:_TestUtil.java   
public static void checkReader(AtomicReader reader, boolean crossCheckTermVectors) throws IOException {
  ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
  PrintStream infoStream = new PrintStream(bos, false, "UTF-8");

  FieldNormStatus fieldNormStatus = CheckIndex.testFieldNorms(reader, infoStream);
  TermIndexStatus termIndexStatus = CheckIndex.testPostings(reader, infoStream);
  StoredFieldStatus storedFieldStatus = CheckIndex.testStoredFields(reader, infoStream);
  TermVectorStatus termVectorStatus = CheckIndex.testTermVectors(reader, infoStream, false, crossCheckTermVectors);
  DocValuesStatus docValuesStatus = CheckIndex.testDocValues(reader, infoStream);

  if (fieldNormStatus.error != null || 
    termIndexStatus.error != null ||
    storedFieldStatus.error != null ||
    termVectorStatus.error != null ||
    docValuesStatus.error != null) {
    System.out.println("CheckReader failed");
    System.out.println(bos.toString("UTF-8"));
    throw new RuntimeException("CheckReader failed");
  } else {
    if (LuceneTestCase.INFOSTREAM) {
      System.out.println(bos.toString("UTF-8"));
    }
  }
}
项目:search    文件:TestUtil.java   
public static void checkReader(AtomicReader reader, boolean crossCheckTermVectors) throws IOException {
  ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
  PrintStream infoStream = new PrintStream(bos, false, IOUtils.UTF_8);

  reader.checkIntegrity();
  FieldNormStatus fieldNormStatus = CheckIndex.testFieldNorms(reader, infoStream, true);
  TermIndexStatus termIndexStatus = CheckIndex.testPostings(reader, infoStream, false, true);
  StoredFieldStatus storedFieldStatus = CheckIndex.testStoredFields(reader, infoStream, true);
  TermVectorStatus termVectorStatus = CheckIndex.testTermVectors(reader, infoStream, false, crossCheckTermVectors, true);
  DocValuesStatus docValuesStatus = CheckIndex.testDocValues(reader, infoStream, true);

  if (LuceneTestCase.INFOSTREAM) {
    System.out.println(bos.toString(IOUtils.UTF_8));
  }
}
项目:read-open-source-code    文件:CheckIndex.java   
/**
 * Test docvalues.
 * @lucene.experimental
 */
public static Status.DocValuesStatus testDocValues(AtomicReader reader,
                                                   PrintStream infoStream) {
  final Status.DocValuesStatus status = new Status.DocValuesStatus();
  try {
    if (infoStream != null) {
      infoStream.print("    test: docvalues...........");
    }
    for (FieldInfo fieldInfo : reader.getFieldInfos()) {
      if (fieldInfo.hasDocValues()) {
        status.totalValueFields++;
        checkDocValues(fieldInfo, reader, infoStream, status);
      } else {
        if (reader.getBinaryDocValues(fieldInfo.name) != null ||
            reader.getNumericDocValues(fieldInfo.name) != null ||
            reader.getSortedDocValues(fieldInfo.name) != null || 
            reader.getSortedSetDocValues(fieldInfo.name) != null || 
            reader.getDocsWithField(fieldInfo.name) != null) {
          throw new RuntimeException("field: " + fieldInfo.name + " has docvalues but should omit them!");
        }
      }
    }

    msg(infoStream, "OK [" + status.totalValueFields + " docvalues fields; "
                           + status.totalBinaryFields + " BINARY; " 
                           + status.totalNumericFields + " NUMERIC; "
                           + status.totalSortedFields + " SORTED; "
                           + status.totalSortedSetFields + " SORTED_SET]");
  } catch (Throwable e) {
    msg(infoStream, "ERROR [" + String.valueOf(e.getMessage()) + "]");
    status.error = e;
    if (infoStream != null) {
      e.printStackTrace(infoStream);
    }
  }
  return status;
}
项目:read-open-source-code    文件:CheckIndex.java   
/**
 * Test docvalues.
 * @lucene.experimental
 */
public static Status.DocValuesStatus testDocValues(AtomicReader reader,
                                                   PrintStream infoStream) {
  final Status.DocValuesStatus status = new Status.DocValuesStatus();
  try {
    if (infoStream != null) {
      infoStream.print("    test: docvalues...........");
    }
    for (FieldInfo fieldInfo : reader.getFieldInfos()) {
      if (fieldInfo.hasDocValues()) {
        status.totalValueFields++;
        checkDocValues(fieldInfo, reader, infoStream, status);
      } else {
        if (reader.getBinaryDocValues(fieldInfo.name) != null ||
            reader.getNumericDocValues(fieldInfo.name) != null ||
            reader.getSortedDocValues(fieldInfo.name) != null || 
            reader.getSortedSetDocValues(fieldInfo.name) != null || 
            reader.getDocsWithField(fieldInfo.name) != null) {
          throw new RuntimeException("field: " + fieldInfo.name + " has docvalues but should omit them!");
        }
      }
    }

    msg(infoStream, "OK [" + status.totalValueFields + " docvalues fields; "
                           + status.totalBinaryFields + " BINARY; " 
                           + status.totalNumericFields + " NUMERIC; "
                           + status.totalSortedFields + " SORTED; "
                           + status.totalSortedSetFields + " SORTED_SET]");
  } catch (Throwable e) {
    msg(infoStream, "ERROR [" + String.valueOf(e.getMessage()) + "]");
    status.error = e;
    if (infoStream != null) {
      e.printStackTrace(infoStream);
    }
  }
  return status;
}
项目:Maskana-Gestor-de-Conocimiento    文件:CheckIndex.java   
/**
 * Test docvalues.
 * @lucene.experimental
 */
public static Status.DocValuesStatus testDocValues(AtomicReader reader,
                                                   PrintStream infoStream) {
  final Status.DocValuesStatus status = new Status.DocValuesStatus();
  try {
    if (infoStream != null) {
      infoStream.print("    test: docvalues...........");
    }
    for (FieldInfo fieldInfo : reader.getFieldInfos()) {
      if (fieldInfo.hasDocValues()) {
        status.totalValueFields++;
        checkDocValues(fieldInfo, reader, infoStream, status);
      } else {
        if (reader.getBinaryDocValues(fieldInfo.name) != null ||
            reader.getNumericDocValues(fieldInfo.name) != null ||
            reader.getSortedDocValues(fieldInfo.name) != null || 
            reader.getSortedSetDocValues(fieldInfo.name) != null || 
            reader.getDocsWithField(fieldInfo.name) != null) {
          throw new RuntimeException("field: " + fieldInfo.name + " has docvalues but should omit them!");
        }
      }
    }

    msg(infoStream, "OK [" + status.totalValueFields + " docvalues fields; "
                           + status.totalBinaryFields + " BINARY; " 
                           + status.totalNumericFields + " NUMERIC; "
                           + status.totalSortedFields + " SORTED; "
                           + status.totalSortedSetFields + " SORTED_SET]");
  } catch (Throwable e) {
    msg(infoStream, "ERROR [" + String.valueOf(e.getMessage()) + "]");
    status.error = e;
    if (infoStream != null) {
      e.printStackTrace(infoStream);
    }
  }
  return status;
}
项目:lams    文件:CheckIndex.java   
DocValuesStatus() {
}
项目:lams    文件:CheckIndex.java   
/**
 * Test docvalues.
 * @lucene.experimental
 */
public static Status.DocValuesStatus testDocValues(AtomicReader reader,
                                                   PrintStream infoStream,
                                                   boolean failFast) throws IOException {
  final Status.DocValuesStatus status = new Status.DocValuesStatus();
  try {
    if (infoStream != null) {
      infoStream.print("    test: docvalues...........");
    }
    for (FieldInfo fieldInfo : reader.getFieldInfos()) {
      if (fieldInfo.hasDocValues()) {
        status.totalValueFields++;
        checkDocValues(fieldInfo, reader, infoStream, status);
      } else {
        if (reader.getBinaryDocValues(fieldInfo.name) != null ||
            reader.getNumericDocValues(fieldInfo.name) != null ||
            reader.getSortedDocValues(fieldInfo.name) != null || 
            reader.getSortedSetDocValues(fieldInfo.name) != null || 
            reader.getDocsWithField(fieldInfo.name) != null) {
          throw new RuntimeException("field: " + fieldInfo.name + " has docvalues but should omit them!");
        }
      }
    }

    msg(infoStream, "OK [" + status.totalValueFields + " docvalues fields; "
                           + status.totalBinaryFields + " BINARY; " 
                           + status.totalNumericFields + " NUMERIC; "
                           + status.totalSortedFields + " SORTED; "
                           + status.totalSortedNumericFields + " SORTED_NUMERIC; "
                           + status.totalSortedSetFields + " SORTED_SET]");
  } catch (Throwable e) {
    if (failFast) {
      IOUtils.reThrow(e);
    }
    msg(infoStream, "ERROR [" + String.valueOf(e.getMessage()) + "]");
    status.error = e;
    if (infoStream != null) {
      e.printStackTrace(infoStream);
    }
  }
  return status;
}
项目:lams    文件:CheckIndex.java   
private static void checkDocValues(FieldInfo fi, AtomicReader reader, PrintStream infoStream, DocValuesStatus status) throws Exception {
  Bits docsWithField = reader.getDocsWithField(fi.name);
  if (docsWithField == null) {
    throw new RuntimeException(fi.name + " docsWithField does not exist");
  } else if (docsWithField.length() != reader.maxDoc()) {
    throw new RuntimeException(fi.name + " docsWithField has incorrect length: " + docsWithField.length() + ",expected: " + reader.maxDoc());
  }
  switch(fi.getDocValuesType()) {
    case SORTED:
      status.totalSortedFields++;
      checkSortedDocValues(fi.name, reader, reader.getSortedDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case SORTED_NUMERIC:
      status.totalSortedNumericFields++;
      checkSortedNumericDocValues(fi.name, reader, reader.getSortedNumericDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case SORTED_SET:
      status.totalSortedSetFields++;
      checkSortedSetDocValues(fi.name, reader, reader.getSortedSetDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedNumericDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case BINARY:
      status.totalBinaryFields++;
      checkBinaryDocValues(fi.name, reader, reader.getBinaryDocValues(fi.name), docsWithField);
      if (reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null ||
          reader.getSortedNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case NUMERIC:
      status.totalNumericFields++;
      checkNumericDocValues(fi.name, reader, reader.getNumericDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null ||
          reader.getSortedNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    default:
      throw new AssertionError();
  }
}
项目:search    文件:CheckIndex.java   
DocValuesStatus() {
}
项目:search    文件:CheckIndex.java   
/**
 * Test docvalues.
 * @lucene.experimental
 */
public static Status.DocValuesStatus testDocValues(AtomicReader reader,
                                                   PrintStream infoStream,
                                                   boolean failFast) throws IOException {
  final Status.DocValuesStatus status = new Status.DocValuesStatus();
  try {
    if (infoStream != null) {
      infoStream.print("    test: docvalues...........");
    }
    for (FieldInfo fieldInfo : reader.getFieldInfos()) {
      if (fieldInfo.hasDocValues()) {
        status.totalValueFields++;
        checkDocValues(fieldInfo, reader, infoStream, status);
      } else {
        if (reader.getBinaryDocValues(fieldInfo.name) != null ||
            reader.getNumericDocValues(fieldInfo.name) != null ||
            reader.getSortedDocValues(fieldInfo.name) != null || 
            reader.getSortedSetDocValues(fieldInfo.name) != null || 
            reader.getDocsWithField(fieldInfo.name) != null) {
          throw new RuntimeException("field: " + fieldInfo.name + " has docvalues but should omit them!");
        }
      }
    }

    msg(infoStream, "OK [" + status.totalValueFields + " docvalues fields; "
                           + status.totalBinaryFields + " BINARY; " 
                           + status.totalNumericFields + " NUMERIC; "
                           + status.totalSortedFields + " SORTED; "
                           + status.totalSortedNumericFields + " SORTED_NUMERIC; "
                           + status.totalSortedSetFields + " SORTED_SET]");
  } catch (Throwable e) {
    if (failFast) {
      IOUtils.reThrow(e);
    }
    msg(infoStream, "ERROR [" + String.valueOf(e.getMessage()) + "]");
    status.error = e;
    if (infoStream != null) {
      e.printStackTrace(infoStream);
    }
  }
  return status;
}
项目:search    文件:CheckIndex.java   
private static void checkDocValues(FieldInfo fi, AtomicReader reader, PrintStream infoStream, DocValuesStatus status) throws Exception {
  Bits docsWithField = reader.getDocsWithField(fi.name);
  if (docsWithField == null) {
    throw new RuntimeException(fi.name + " docsWithField does not exist");
  } else if (docsWithField.length() != reader.maxDoc()) {
    throw new RuntimeException(fi.name + " docsWithField has incorrect length: " + docsWithField.length() + ",expected: " + reader.maxDoc());
  }
  switch(fi.getDocValuesType()) {
    case SORTED:
      status.totalSortedFields++;
      checkSortedDocValues(fi.name, reader, reader.getSortedDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case SORTED_NUMERIC:
      status.totalSortedNumericFields++;
      checkSortedNumericDocValues(fi.name, reader, reader.getSortedNumericDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case SORTED_SET:
      status.totalSortedSetFields++;
      checkSortedSetDocValues(fi.name, reader, reader.getSortedSetDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedNumericDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case BINARY:
      status.totalBinaryFields++;
      checkBinaryDocValues(fi.name, reader, reader.getBinaryDocValues(fi.name), docsWithField);
      if (reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null ||
          reader.getSortedNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case NUMERIC:
      status.totalNumericFields++;
      checkNumericDocValues(fi.name, reader, reader.getNumericDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null ||
          reader.getSortedNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    default:
      throw new AssertionError();
  }
}
项目:read-open-source-code    文件:CheckIndex.java   
DocValuesStatus() {
}
项目:read-open-source-code    文件:CheckIndex.java   
private static void checkDocValues(FieldInfo fi, AtomicReader reader, PrintStream infoStream, DocValuesStatus status) throws Exception {
  Bits docsWithField = reader.getDocsWithField(fi.name);
  if (docsWithField == null) {
    throw new RuntimeException(fi.name + " docsWithField does not exist");
  } else if (docsWithField.length() != reader.maxDoc()) {
    throw new RuntimeException(fi.name + " docsWithField has incorrect length: " + docsWithField.length() + ",expected: " + reader.maxDoc());
  }
  switch(fi.getDocValuesType()) {
    case SORTED:
      status.totalSortedFields++;
      checkSortedDocValues(fi.name, reader, reader.getSortedDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case SORTED_SET:
      status.totalSortedSetFields++;
      checkSortedSetDocValues(fi.name, reader, reader.getSortedSetDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case BINARY:
      status.totalBinaryFields++;
      checkBinaryDocValues(fi.name, reader, reader.getBinaryDocValues(fi.name), docsWithField);
      if (reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case NUMERIC:
      status.totalNumericFields++;
      checkNumericDocValues(fi.name, reader, reader.getNumericDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    default:
      throw new AssertionError();
  }
}
项目:read-open-source-code    文件:CheckIndex.java   
DocValuesStatus() {
}
项目:read-open-source-code    文件:CheckIndex.java   
private static void checkDocValues(FieldInfo fi, AtomicReader reader, PrintStream infoStream, DocValuesStatus status) throws Exception {
  Bits docsWithField = reader.getDocsWithField(fi.name);
  if (docsWithField == null) {
    throw new RuntimeException(fi.name + " docsWithField does not exist");
  } else if (docsWithField.length() != reader.maxDoc()) {
    throw new RuntimeException(fi.name + " docsWithField has incorrect length: " + docsWithField.length() + ",expected: " + reader.maxDoc());
  }
  switch(fi.getDocValuesType()) {
    case SORTED:
      status.totalSortedFields++;
      checkSortedDocValues(fi.name, reader, reader.getSortedDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case SORTED_SET:
      status.totalSortedSetFields++;
      checkSortedSetDocValues(fi.name, reader, reader.getSortedSetDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case BINARY:
      status.totalBinaryFields++;
      checkBinaryDocValues(fi.name, reader, reader.getBinaryDocValues(fi.name), docsWithField);
      if (reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case NUMERIC:
      status.totalNumericFields++;
      checkNumericDocValues(fi.name, reader, reader.getNumericDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    default:
      throw new AssertionError();
  }
}
项目:read-open-source-code    文件:CheckIndex.java   
DocValuesStatus() {
}
项目:read-open-source-code    文件:CheckIndex.java   
/**
 * Test docvalues.
 * @lucene.experimental
 */
public static Status.DocValuesStatus testDocValues(AtomicReader reader,
                                                   PrintStream infoStream,
                                                   boolean failFast) throws IOException {
  final Status.DocValuesStatus status = new Status.DocValuesStatus();
  try {
    if (infoStream != null) {
      infoStream.print("    test: docvalues...........");
    }
    for (FieldInfo fieldInfo : reader.getFieldInfos()) {
      if (fieldInfo.hasDocValues()) {
        status.totalValueFields++;
        checkDocValues(fieldInfo, reader, infoStream, status);
      } else {
        if (reader.getBinaryDocValues(fieldInfo.name) != null ||
            reader.getNumericDocValues(fieldInfo.name) != null ||
            reader.getSortedDocValues(fieldInfo.name) != null || 
            reader.getSortedSetDocValues(fieldInfo.name) != null || 
            reader.getDocsWithField(fieldInfo.name) != null) {
          throw new RuntimeException("field: " + fieldInfo.name + " has docvalues but should omit them!");
        }
      }
    }

    msg(infoStream, "OK [" + status.totalValueFields + " docvalues fields; "
                           + status.totalBinaryFields + " BINARY; " 
                           + status.totalNumericFields + " NUMERIC; "
                           + status.totalSortedFields + " SORTED; "
                           + status.totalSortedNumericFields + " SORTED_NUMERIC; "
                           + status.totalSortedSetFields + " SORTED_SET]");
  } catch (Throwable e) {
    if (failFast) {
      IOUtils.reThrow(e);
    }
    msg(infoStream, "ERROR [" + String.valueOf(e.getMessage()) + "]");
    status.error = e;
    if (infoStream != null) {
      e.printStackTrace(infoStream);
    }
  }
  return status;
}
项目:read-open-source-code    文件:CheckIndex.java   
private static void checkDocValues(FieldInfo fi, AtomicReader reader, PrintStream infoStream, DocValuesStatus status) throws Exception {
  Bits docsWithField = reader.getDocsWithField(fi.name);
  if (docsWithField == null) {
    throw new RuntimeException(fi.name + " docsWithField does not exist");
  } else if (docsWithField.length() != reader.maxDoc()) {
    throw new RuntimeException(fi.name + " docsWithField has incorrect length: " + docsWithField.length() + ",expected: " + reader.maxDoc());
  }
  switch(fi.getDocValuesType()) {
    case SORTED:
      status.totalSortedFields++;
      checkSortedDocValues(fi.name, reader, reader.getSortedDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case SORTED_NUMERIC:
      status.totalSortedNumericFields++;
      checkSortedNumericDocValues(fi.name, reader, reader.getSortedNumericDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case SORTED_SET:
      status.totalSortedSetFields++;
      checkSortedSetDocValues(fi.name, reader, reader.getSortedSetDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedNumericDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case BINARY:
      status.totalBinaryFields++;
      checkBinaryDocValues(fi.name, reader, reader.getBinaryDocValues(fi.name), docsWithField);
      if (reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null ||
          reader.getSortedNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case NUMERIC:
      status.totalNumericFields++;
      checkNumericDocValues(fi.name, reader, reader.getNumericDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null ||
          reader.getSortedNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    default:
      throw new AssertionError();
  }
}
项目:Maskana-Gestor-de-Conocimiento    文件:CheckIndex.java   
DocValuesStatus() {
}
项目:Maskana-Gestor-de-Conocimiento    文件:CheckIndex.java   
private static void checkDocValues(FieldInfo fi, AtomicReader reader, PrintStream infoStream, DocValuesStatus status) throws Exception {
  Bits docsWithField = reader.getDocsWithField(fi.name);
  if (docsWithField == null) {
    throw new RuntimeException(fi.name + " docsWithField does not exist");
  } else if (docsWithField.length() != reader.maxDoc()) {
    throw new RuntimeException(fi.name + " docsWithField has incorrect length: " + docsWithField.length() + ",expected: " + reader.maxDoc());
  }
  switch(fi.getDocValuesType()) {
    case SORTED:
      status.totalSortedFields++;
      checkSortedDocValues(fi.name, reader, reader.getSortedDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case SORTED_SET:
      status.totalSortedSetFields++;
      checkSortedSetDocValues(fi.name, reader, reader.getSortedSetDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case BINARY:
      status.totalBinaryFields++;
      checkBinaryDocValues(fi.name, reader, reader.getBinaryDocValues(fi.name), docsWithField);
      if (reader.getNumericDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    case NUMERIC:
      status.totalNumericFields++;
      checkNumericDocValues(fi.name, reader, reader.getNumericDocValues(fi.name), docsWithField);
      if (reader.getBinaryDocValues(fi.name) != null ||
          reader.getSortedDocValues(fi.name) != null ||
          reader.getSortedSetDocValues(fi.name) != null) {
        throw new RuntimeException(fi.name + " returns multiple docvalues types!");
      }
      break;
    default:
      throw new AssertionError();
  }
}