當前位置: 首頁>>代碼示例>>Java>>正文


Java IndexInput.readStringSet方法代碼示例

本文整理匯總了Java中org.apache.lucene.store.IndexInput.readStringSet方法的典型用法代碼示例。如果您正苦於以下問題:Java IndexInput.readStringSet方法的具體用法?Java IndexInput.readStringSet怎麽用?Java IndexInput.readStringSet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.lucene.store.IndexInput的用法示例。


在下文中一共展示了IndexInput.readStringSet方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readUpgradedSegmentInfo

import org.apache.lucene.store.IndexInput; //導入方法依賴的package包/類
private SegmentInfo readUpgradedSegmentInfo(String name, Directory dir, IndexInput input) throws IOException {
  CodecUtil.checkHeader(input, Lucene3xSegmentInfoFormat.UPGRADED_SI_CODEC_NAME,
                               Lucene3xSegmentInfoFormat.UPGRADED_SI_VERSION_START,
                               Lucene3xSegmentInfoFormat.UPGRADED_SI_VERSION_CURRENT);
  final Version version;
  try {
    version = Version.parse(input.readString());
  } catch (ParseException pe) {
    throw new CorruptIndexException("unable to parse version string (input: " + input + "): " + pe.getMessage(), pe);
  }

  final int docCount = input.readInt();
  
  final Map<String,String> attributes = input.readStringStringMap();

  final boolean isCompoundFile = input.readByte() == SegmentInfo.YES;

  final Map<String,String> diagnostics = input.readStringStringMap();

  final Set<String> files = input.readStringSet();

  SegmentInfo info = new SegmentInfo(dir, version, name, docCount, isCompoundFile,
                                     null, diagnostics, Collections.unmodifiableMap(attributes));
  info.setFiles(files);
  return info;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:27,代碼來源:Lucene3xSegmentInfoReader.java

示例2: read

import org.apache.lucene.store.IndexInput; //導入方法依賴的package包/類
@Override
public SegmentInfo read(Directory dir, String segment, IOContext context) throws IOException {
  final String fileName = IndexFileNames.segmentFileName(segment, "", Lucene40SegmentInfoFormat.SI_EXTENSION);
  final IndexInput input = dir.openInput(fileName, context);
  boolean success = false;
  try {
    CodecUtil.checkHeader(input, Lucene40SegmentInfoFormat.CODEC_NAME,
                                 Lucene40SegmentInfoFormat.VERSION_START,
                                 Lucene40SegmentInfoFormat.VERSION_CURRENT);
    final Version version;
    try {
      version = Version.parse(input.readString());
    } catch (ParseException pe) {
      throw new CorruptIndexException("unable to parse version string (resource=" + input + "): " + pe.getMessage(), pe);
    }

    final int docCount = input.readInt();
    if (docCount < 0) {
      throw new CorruptIndexException("invalid docCount: " + docCount + " (resource=" + input + ")");
    }
    final boolean isCompoundFile = input.readByte() == SegmentInfo.YES;
    final Map<String,String> diagnostics = input.readStringStringMap();
    input.readStringStringMap(); // read deprecated attributes
    final Set<String> files = input.readStringSet();
    
    CodecUtil.checkEOF(input);

    final SegmentInfo si = new SegmentInfo(dir, version, segment, docCount, isCompoundFile, null, diagnostics);
    si.setFiles(files);

    success = true;

    return si;

  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(input);
    } else {
      input.close();
    }
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:43,代碼來源:Lucene40SegmentInfoReader.java


注:本文中的org.apache.lucene.store.IndexInput.readStringSet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。