• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DocValuesStatus类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.apache.lucene.index.CheckIndex.Status.DocValuesStatus的典型用法代码示例。如果您正苦于以下问题:Java DocValuesStatus类的具体用法?Java DocValuesStatus怎么用?Java DocValuesStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DocValuesStatus类属于org.apache.lucene.index.CheckIndex.Status包,在下文中一共展示了DocValuesStatus类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkReader

点赞 3

import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus; //导入依赖的package包/类
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"));
    }
  }
}
 

开发者ID:pkarmstr,
项目名称:NYBC,
代码行数:25,
代码来源:_TestUtil.java

示例2: checkReader

点赞 2

import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus; //导入依赖的package包/类
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));
  }
}
 

开发者ID:europeana,
项目名称:search,
代码行数:16,
代码来源:TestUtil.java

示例3: testDocValues

点赞 2

import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus; //导入依赖的package包/类
/**
 * 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;
}
 

开发者ID:yintaoxue,
项目名称:read-open-source-code,
代码行数:41,
代码来源:CheckIndex.java

示例4: DocValuesStatus

点赞 2

import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus; //导入依赖的package包/类
DocValuesStatus() {
}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:3,
代码来源:CheckIndex.java

示例5: testDocValues

点赞 2

import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus; //导入依赖的package包/类
/**
 * 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;
}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:46,
代码来源:CheckIndex.java

示例6: checkDocValues

点赞 2

import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus; //导入依赖的package包/类
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();
  }
}
 

开发者ID:lamsfoundation,
项目名称:lams,
代码行数:63,
代码来源:CheckIndex.java

示例7: checkDocValues

点赞 2

import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus; //导入依赖的package包/类
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();
  }
}
 

开发者ID:yintaoxue,
项目名称:read-open-source-code,
代码行数:49,
代码来源:CheckIndex.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)