Package org.apache.lucene.store

Examples of org.apache.lucene.store.SimpleFSDirectory$SimpleFSIndexOutput


  {
    Directory ramIdxDir;
    try
    {
      File backingdir = new File("/tmp/ram" + fold);// /Volumes/ramdisk/
      ramIdxDir = new SimpleFSDirectory(backingdir);
      fold++;
      return new RAMSearchIndex<R, V>(version, decorator, idxMgr, ramIdxDir, backingdir);
    } catch (IOException e)
    {
      // TODO Auto-generated catch block
View Full Code Here


    Calendar now = Calendar.getInstance();
    now.setTimeInMillis(timenow);
    Calendar threshold = hg._scheduler.getTrimTime(now);
    for(int i=0; i<toRemove.size(); i++)
    {
      SimpleFSDirectory dir = (SimpleFSDirectory) toRemove.get(i).directory();
      String path = dir.getFile().getName();
      Calendar archivetime = null;
      try
      {
        archivetime = HourglassDirectoryManagerFactory.getCalendarTime(path);
      } catch (ParseException e)
      {
        log.error("index directory name bad. potential corruption. Move on without trimming.", e);
        toKeep.add(toRemove.get(i));
        continue;
      }
      if (archivetime.before(threshold))
      {
        log.info("trimming: remove " + path);
        log.info(dir.getFile() + " -before--" + (dir.getFile().exists()?" not deleted ":" deleted"));
        FileUtil.rmDir(dir.getFile());
        log.info(dir.getFile() + " -after--" + (dir.getFile().exists()?" not deleted ":" deleted"));
      } else
      {
        toKeep.add(toRemove.get(i));
      }
    }
View Full Code Here

   */
  private void consolidate(List<ZoieIndexReader<R>> archived, List<ZoieIndexReader<R>> add)
  {
    log.info("begin consolidate ... ");
    long b4 = System.currentTimeMillis();
    SimpleFSDirectory target = (SimpleFSDirectory) archived.get(0).directory();
    log.info("into: "+target.getFile().getAbsolutePath());
    SimpleFSDirectory sources[] = new SimpleFSDirectory[archived.size()-1];
    @SuppressWarnings("unchecked")
    IndexSignature<V> sigs[] = (IndexSignature<V>[])new IndexSignature[archived.size()];
    sigs[0] = _dirMgrFactory.getIndexSignature(target.getFile()); // the target index signature
    log.info("target version: " + sigs[0].getVersion());
    for(int i=1; i<archived.size(); i++)
View Full Code Here

    zoie.shutdown();
  }
  private IndexReader getArchive(ZoieSystem<R, D, V> zoie) throws CorruptIndexException, IOException
  {
    String dirName = zoie.getAdminMBean().getIndexDir();
    Directory dir = new SimpleFSDirectory(new File(dirName));
    IndexReader reader = null;
    if (IndexReader.indexExists(dir))
    {
      reader  = IndexReader.open(dir, true);
    }
View Full Code Here

  {
    FSDirectory dir = null;
    switch(_mode)
    {
    case SIMPLE:
      dir = new SimpleFSDirectory(f);
      break;
    case NIO:
      dir = new NIOFSDirectory(f);
      break;
    case MMAP:
View Full Code Here

    _overFlowConf = _conf.clone();

    if (_indexLocally) {
      String localDirPath = System.getProperty(JAVA_IO_TMPDIR);
      _localPath = new File(localDirPath, UUID.randomUUID().toString() + ".tmp");
      SimpleFSDirectory directory = new SimpleFSDirectory(_localPath);
      _localDir = new ProgressableDirectory(directory, getProgressable());
      _writer = new IndexWriter(_localDir, _conf.clone());
    } else {
      _localPath = null;
      _localDir = null;
View Full Code Here

    }
    _usingLocalTmpindex = true;
    if (_localTmpWriter == null) {
      String localDirPath = System.getProperty(JAVA_IO_TMPDIR);
      _localTmpPath = new File(localDirPath, UUID.randomUUID().toString() + ".tmp");
      SimpleFSDirectory directory = new SimpleFSDirectory(_localTmpPath);
      _localTmpDir = new ProgressableDirectory(directory, getProgressable());
      _localTmpWriter = new IndexWriter(_localTmpDir, _overFlowConf.clone());
      // The local tmp writer has merging disabled so the first document in is
      // going to be doc 0.
      // Therefore the first document added is the prime doc
View Full Code Here

    _overFlowConf = _conf.clone();

    if (_indexLocally) {
      String localDirPath = System.getProperty(JAVA_IO_TMPDIR);
      _localPath = new File(localDirPath, UUID.randomUUID().toString() + ".tmp");
      SimpleFSDirectory directory = new SimpleFSDirectory(_localPath);
      _localDir = new ProgressableDirectory(directory, getProgressable());
      _writer = new IndexWriter(_localDir, _conf.clone());
    } else {
      _localPath = null;
      _localDir = null;
View Full Code Here

    }
    _usingLocalTmpindex = true;
    if (_localTmpWriter == null) {
      String localDirPath = System.getProperty(JAVA_IO_TMPDIR);
      _localTmpPath = new File(localDirPath, UUID.randomUUID().toString() + ".tmp");
      SimpleFSDirectory directory = new SimpleFSDirectory(_localTmpPath);
      _localTmpDir = new ProgressableDirectory(directory, getProgressable());
      _localTmpWriter = new IndexWriter(_localTmpDir, _overFlowConf.clone());
      // The local tmp writer has merging disabled so the first document in is
      // going to be doc 0.
      // Therefore the first document added is the prime doc
View Full Code Here

    @Override
    public void setUp() throws Exception {
       super.setUp();
       File file = _TestUtil.getTempDir("testIndex");
       // use a simple FSDir here, to be sure to have SimpleFSInputs
       dir = new SimpleFSDirectory(file,null);
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.store.SimpleFSDirectory$SimpleFSIndexOutput

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.