Examples of fileExists()


Examples of org.apache.lucene.store.Directory.fileExists()

           
    // currently the test fails above.
    // however, to test the fix, the following lines should pass as well.
    indexWriter.addDocument(getDocument());
    indexWriter.close();
    assertFalse(realDirectory.fileExists("segments_2"));
    realDirectory.close();
  }
   
  /**
   * Run an example search.
View Full Code Here

Examples of org.apache.lucene.store.Directory.fileExists()

    } catch (CrashingException e) {
      // expected
    }
    // writes segments_3
    indexWriter.close();
    assertFalse(realDirectory.fileExists("segments_2"));
    crashAfterCreateOutput.close();
  }
   
  /**
   * Attempts to index another 1 document.
View Full Code Here

Examples of org.apache.lucene.store.Directory.fileExists()

      out.writeByte((byte) 42);
      out.close();

      new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED).close();

      assertTrue(dir.fileExists("myrandomfile"));

      // Make sure this does not copy myrandomfile:
      Directory dir2 = new RAMDirectory(dir);
      assertTrue(!dir2.fileExists("myrandomfile"));
View Full Code Here

Examples of org.apache.lucene.store.Directory.fileExists()

      assertTrue(dir.fileExists("myrandomfile"));

      // Make sure this does not copy myrandomfile:
      Directory dir2 = new RAMDirectory(dir);
      assertTrue(!dir2.fileExists("myrandomfile"));

    } finally {
      dir.close();
      _TestUtil.rmDir(indexDir);
    }
View Full Code Here

Examples of org.apache.lucene.store.Directory.fileExists()

      taxoWriter.commit();
      Revision rev1 = new IndexAndTaxonomyRevision(indexWriter, taxoWriter);
      // releasing that revision should not delete the files
      rev1.release();
      assertTrue(indexDir.fileExists(IndexFileNames.SEGMENTS + "_1"));
      assertTrue(taxoDir.fileExists(IndexFileNames.SEGMENTS + "_1"));
     
      rev1 = new IndexAndTaxonomyRevision(indexWriter, taxoWriter); // create revision again, so the files are snapshotted
      indexWriter.addDocument(newDocument(taxoWriter));
      indexWriter.commit();
      taxoWriter.commit();
View Full Code Here

Examples of org.apache.lucene.store.Directory.fileExists()

      writer.addDocument(new Document());
      writer.commit();
      Revision rev1 = new IndexRevision(writer);
      // releasing that revision should not delete the files
      rev1.release();
      assertTrue(dir.fileExists(IndexFileNames.SEGMENTS + "_1"));
     
      rev1 = new IndexRevision(writer); // create revision again, so the files are snapshotted
      writer.addDocument(new Document());
      writer.commit();
      assertNotNull(new IndexRevision(writer));
View Full Code Here

Examples of org.apache.lucene.store.Directory.fileExists()

      rev1 = new IndexRevision(writer); // create revision again, so the files are snapshotted
      writer.addDocument(new Document());
      writer.commit();
      assertNotNull(new IndexRevision(writer));
      rev1.release(); // this release should trigger the delete of segments_1
      assertFalse(dir.fileExists(IndexFileNames.SEGMENTS + "_1"));
    } finally {
      IOUtils.close(writer, dir);
    }
  }
 
View Full Code Here

Examples of org.apache.lucene.store.Directory.fileExists()

        //  now open reader again & set norm for doc 0 (writes to _0_2.s0)
        reader = IndexReader.open(dir);
        reader.setNorm(0, "content", (float) 2.0);
        reader.close();
        assertFalse("failed to remove first generation norms file on writing second generation",
                    dir.fileExists("_0_1.s0"));
       
        dir.close();
    }

View Full Code Here

Examples of org.apache.lucene.store.Directory.fileExists()

    copyFile(dir, "segments_2", "segments_1");

    // Create a bogus cfs file shadowing a non-cfs segment:
   
    // TODO: assert is bogus (relies upon codec-specific filenames)
    assertTrue(dir.fileExists("_3.fdt") || dir.fileExists("_3.fld"));
    assertTrue(!dir.fileExists("_3.cfs"));
    copyFile(dir, "_1.cfs", "_3.cfs");
   
    String[] filesPre = dir.listAll();
View Full Code Here

Examples of org.apache.lucene.store.Directory.fileExists()

    copyFile(dir, "segments_2", "segments_1");

    // Create a bogus cfs file shadowing a non-cfs segment:
   
    // TODO: assert is bogus (relies upon codec-specific filenames)
    assertTrue(dir.fileExists("_3.fdt") || dir.fileExists("_3.fld"));
    assertTrue(!dir.fileExists("_3.cfs"));
    copyFile(dir, "_1.cfs", "_3.cfs");
   
    String[] filesPre = dir.listAll();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.