Java 类org.apache.lucene.index.MergeState.CheckAbort 实例源码

项目:lams    文件:IndexWriter.java   
/**
 * NOTE: this method creates a compound file for all files returned by
 * info.files(). While, generally, this may include separate norms and
 * deletion files, this SegmentInfo must not reference such files when this
 * method is called, because they are not allowed within a compound file.
 */
static final Collection<String> createCompoundFile(InfoStream infoStream, Directory directory, CheckAbort checkAbort, final SegmentInfo info, IOContext context)
        throws IOException {

  final String fileName = IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION);
  if (infoStream.isEnabled("IW")) {
    infoStream.message("IW", "create compound file " + fileName);
  }
  assert Lucene3xSegmentInfoFormat.getDocStoreOffset(info) == -1;
  // Now merge all added files
  Collection<String> files = info.files();
  CompoundFileDirectory cfsDir = new CompoundFileDirectory(directory, fileName, context, true);
  boolean success = false;
  try {
    for (String file : files) {
      directory.copy(cfsDir, file, file, context);
      checkAbort.work(directory.fileLength(file));
    }
    success = true;
  } finally {
    if (success) {
      IOUtils.close(cfsDir);
    } else {
      IOUtils.closeWhileHandlingException(cfsDir);
      try {
        directory.deleteFile(fileName);
      } catch (Throwable t) {
      }
      try {
        directory.deleteFile(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
      } catch (Throwable t) {
      }
    }
  }

  // Replace all previous files with the CFS/CFE files:
  Set<String> siFiles = new HashSet<>();
  siFiles.add(fileName);
  siFiles.add(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
  info.setFiles(siFiles);

  return files;
}
项目:search    文件:IndexWriter.java   
/**
 * NOTE: this method creates a compound file for all files returned by
 * info.files(). While, generally, this may include separate norms and
 * deletion files, this SegmentInfo must not reference such files when this
 * method is called, because they are not allowed within a compound file.
 */
static final Collection<String> createCompoundFile(InfoStream infoStream, Directory directory, CheckAbort checkAbort, final SegmentInfo info, IOContext context)
        throws IOException {

  final String fileName = IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION);
  if (infoStream.isEnabled("IW")) {
    infoStream.message("IW", "create compound file " + fileName);
  }
  assert Lucene3xSegmentInfoFormat.getDocStoreOffset(info) == -1;
  // Now merge all added files
  Collection<String> files = info.files();
  CompoundFileDirectory cfsDir = new CompoundFileDirectory(directory, fileName, context, true);
  boolean success = false;
  try {
    for (String file : files) {
      directory.copy(cfsDir, file, file, context);
      checkAbort.work(directory.fileLength(file));
    }
    success = true;
  } finally {
    if (success) {
      IOUtils.close(cfsDir);
    } else {
      IOUtils.closeWhileHandlingException(cfsDir);
      try {
        directory.deleteFile(fileName);
      } catch (Throwable t) {
      }
      try {
        directory.deleteFile(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
      } catch (Throwable t) {
      }
    }
  }

  // Replace all previous files with the CFS/CFE files:
  Set<String> siFiles = new HashSet<>();
  siFiles.add(fileName);
  siFiles.add(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
  info.setFiles(siFiles);

  return files;
}
项目:NYBC    文件:IndexWriter.java   
/**
 * NOTE: this method creates a compound file for all files returned by
 * info.files(). While, generally, this may include separate norms and
 * deletion files, this SegmentInfo must not reference such files when this
 * method is called, because they are not allowed within a compound file.
 */
static final Collection<String> createCompoundFile(InfoStream infoStream, Directory directory, CheckAbort checkAbort, final SegmentInfo info, IOContext context)
        throws IOException {

  final String fileName = IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION);
  if (infoStream.isEnabled("IW")) {
    infoStream.message("IW", "create compound file " + fileName);
  }
  assert Lucene3xSegmentInfoFormat.getDocStoreOffset(info) == -1;
  // Now merge all added files
  Collection<String> files = info.files();
  CompoundFileDirectory cfsDir = new CompoundFileDirectory(directory, fileName, context, true);
  IOException prior = null;
  try {
    for (String file : files) {
      directory.copy(cfsDir, file, file, context);
      checkAbort.work(directory.fileLength(file));
    }
  } catch(IOException ex) {
    prior = ex;
  } finally {
    boolean success = false;
    try {
      IOUtils.closeWhileHandlingException(prior, cfsDir);
      success = true;
    } finally {
      if (!success) {
        try {
          directory.deleteFile(fileName);
        } catch (Throwable t) {
        }
        try {
          directory.deleteFile(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
        } catch (Throwable t) {
        }
      }
    }
  }

  // Replace all previous files with the CFS/CFE files:
  Set<String> siFiles = new HashSet<String>();
  siFiles.add(fileName);
  siFiles.add(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
  info.setFiles(siFiles);

  return files;
}
项目:read-open-source-code    文件:IndexWriter.java   
/**
 * NOTE: this method creates a compound file for all files returned by
 * info.files(). While, generally, this may include separate norms and
 * deletion files, this SegmentInfo must not reference such files when this
 * method is called, because they are not allowed within a compound file.
 */
static final Collection<String> createCompoundFile(InfoStream infoStream, Directory directory, CheckAbort checkAbort, final SegmentInfo info, IOContext context)
        throws IOException {

  final String fileName = IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION);
  if (infoStream.isEnabled("IW")) {
    infoStream.message("IW", "create compound file " + fileName);
  }
  assert Lucene3xSegmentInfoFormat.getDocStoreOffset(info) == -1;
  // Now merge all added files
  Collection<String> files = info.files();
  CompoundFileDirectory cfsDir = new CompoundFileDirectory(directory, fileName, context, true);
  IOException prior = null;
  try {
    for (String file : files) {
      directory.copy(cfsDir, file, file, context);
      checkAbort.work(directory.fileLength(file));
    }
  } catch(IOException ex) {
    prior = ex;
  } finally {
    boolean success = false;
    try {
      IOUtils.closeWhileHandlingException(prior, cfsDir);
      success = true;
    } finally {
      if (!success) {
        try {
          directory.deleteFile(fileName);
        } catch (Throwable t) {
        }
        try {
          directory.deleteFile(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
        } catch (Throwable t) {
        }
      }
    }
  }

  // Replace all previous files with the CFS/CFE files:
  Set<String> siFiles = new HashSet<String>();
  siFiles.add(fileName);
  siFiles.add(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
  info.setFiles(siFiles);

  return files;
}
项目:read-open-source-code    文件:IndexWriter.java   
/**
 * NOTE: this method creates a compound file for all files returned by
 * info.files(). While, generally, this may include separate norms and
 * deletion files, this SegmentInfo must not reference such files when this
 * method is called, because they are not allowed within a compound file.
 */
static final Collection<String> createCompoundFile(InfoStream infoStream, Directory directory, CheckAbort checkAbort, final SegmentInfo info, IOContext context)
        throws IOException {

  final String fileName = IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION);
  if (infoStream.isEnabled("IW")) {
    infoStream.message("IW", "create compound file " + fileName);
  }
  assert Lucene3xSegmentInfoFormat.getDocStoreOffset(info) == -1;
  // Now merge all added files
  Collection<String> files = info.files();
  CompoundFileDirectory cfsDir = new CompoundFileDirectory(directory, fileName, context, true);
  IOException prior = null;
  try {
    for (String file : files) {
      directory.copy(cfsDir, file, file, context);
      checkAbort.work(directory.fileLength(file));
    }
  } catch(IOException ex) {
    prior = ex;
  } finally {
    boolean success = false;
    try {
      IOUtils.closeWhileHandlingException(prior, cfsDir);
      success = true;
    } finally {
      if (!success) {
        try {
          directory.deleteFile(fileName);
        } catch (Throwable t) {
        }
        try {
          directory.deleteFile(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
        } catch (Throwable t) {
        }
      }
    }
  }

  // Replace all previous files with the CFS/CFE files:
  Set<String> siFiles = new HashSet<String>();
  siFiles.add(fileName);
  siFiles.add(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
  info.setFiles(siFiles);

  return files;
}
项目:read-open-source-code    文件:IndexWriter.java   
/**
 * NOTE: this method creates a compound file for all files returned by
 * info.files(). While, generally, this may include separate norms and
 * deletion files, this SegmentInfo must not reference such files when this
 * method is called, because they are not allowed within a compound file.
 */
static final Collection<String> createCompoundFile(InfoStream infoStream, Directory directory, CheckAbort checkAbort, final SegmentInfo info, IOContext context)
        throws IOException {

  final String fileName = IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION);
  if (infoStream.isEnabled("IW")) {
    infoStream.message("IW", "create compound file " + fileName);
  }
  assert Lucene3xSegmentInfoFormat.getDocStoreOffset(info) == -1;
  // Now merge all added files
  Collection<String> files = info.files();
  CompoundFileDirectory cfsDir = new CompoundFileDirectory(directory, fileName, context, true);
  boolean success = false;
  try {
    for (String file : files) {
      directory.copy(cfsDir, file, file, context);
      checkAbort.work(directory.fileLength(file));
    }
    success = true;
  } finally {
    if (success) {
      IOUtils.close(cfsDir);
    } else {
      IOUtils.closeWhileHandlingException(cfsDir);
      try {
        directory.deleteFile(fileName);
      } catch (Throwable t) {
      }
      try {
        directory.deleteFile(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
      } catch (Throwable t) {
      }
    }
  }

  // Replace all previous files with the CFS/CFE files:
  Set<String> siFiles = new HashSet<>();
  siFiles.add(fileName);
  siFiles.add(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
  info.setFiles(siFiles);

  return files;
}
项目:Maskana-Gestor-de-Conocimiento    文件:IndexWriter.java   
/**
 * NOTE: this method creates a compound file for all files returned by
 * info.files(). While, generally, this may include separate norms and
 * deletion files, this SegmentInfo must not reference such files when this
 * method is called, because they are not allowed within a compound file.
 */
static final Collection<String> createCompoundFile(InfoStream infoStream, Directory directory, CheckAbort checkAbort, final SegmentInfo info, IOContext context)
        throws IOException {

  final String fileName = IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION);
  if (infoStream.isEnabled("IW")) {
    infoStream.message("IW", "create compound file " + fileName);
  }
  assert Lucene3xSegmentInfoFormat.getDocStoreOffset(info) == -1;
  // Now merge all added files
  Collection<String> files = info.files();
  CompoundFileDirectory cfsDir = new CompoundFileDirectory(directory, fileName, context, true);
  IOException prior = null;
  try {
    for (String file : files) {
      directory.copy(cfsDir, file, file, context);
      checkAbort.work(directory.fileLength(file));
    }
  } catch(IOException ex) {
    prior = ex;
  } finally {
    boolean success = false;
    try {
      IOUtils.closeWhileHandlingException(prior, cfsDir);
      success = true;
    } finally {
      if (!success) {
        try {
          directory.deleteFile(fileName);
        } catch (Throwable t) {
        }
        try {
          directory.deleteFile(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
        } catch (Throwable t) {
        }
      }
    }
  }

  // Replace all previous files with the CFS/CFE files:
  Set<String> siFiles = new HashSet<String>();
  siFiles.add(fileName);
  siFiles.add(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
  info.setFiles(siFiles);

  return files;
}