Package org.apache.lucene.replicator.IndexAndTaxonomyRevision

Examples of org.apache.lucene.replicator.IndexAndTaxonomyRevision.SnapshotDirectoryTaxonomyWriter.commit()


    Directory taxoDir = newDirectory();
    SnapshotDirectoryTaxonomyWriter taxoWriter = new SnapshotDirectoryTaxonomyWriter(taxoDir);
    try {
      indexWriter.addDocument(newDocument(taxoWriter));
      indexWriter.commit();
      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"));
View Full Code Here


      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();
      assertNotNull(new IndexAndTaxonomyRevision(indexWriter, taxoWriter));
      rev1.release(); // this release should trigger the delete of segments_1
      assertFalse(indexDir.fileExists(IndexFileNames.SEGMENTS + "_1"));
    } finally {
      IOUtils.close(indexWriter, taxoWriter, taxoDir, indexDir);
View Full Code Here

    Directory taxoDir = newDirectory();
    SnapshotDirectoryTaxonomyWriter taxoWriter = new SnapshotDirectoryTaxonomyWriter(taxoDir);
    try {
      indexWriter.addDocument(newDocument(taxoWriter));
      indexWriter.commit();
      taxoWriter.commit();
      Revision rev = new IndexAndTaxonomyRevision(indexWriter, taxoWriter);
      Map<String,List<RevisionFile>> sourceFiles = rev.getSourceFiles();
      assertEquals(2, sourceFiles.size());
      for (List<RevisionFile> files : sourceFiles.values()) {
        String lastFile = files.get(files.size() - 1).fileName;
View Full Code Here

    Directory taxoDir = newDirectory();
    SnapshotDirectoryTaxonomyWriter taxoWriter = new SnapshotDirectoryTaxonomyWriter(taxoDir);
    try {
      indexWriter.addDocument(newDocument(taxoWriter));
      indexWriter.commit();
      taxoWriter.commit();
      Revision rev = new IndexAndTaxonomyRevision(indexWriter, taxoWriter);
      for (Entry<String,List<RevisionFile>> e : rev.getSourceFiles().entrySet()) {
        String source = e.getKey();
        Directory dir = source.equals(IndexAndTaxonomyRevision.INDEX_SOURCE) ? indexDir : taxoDir;
        for (RevisionFile file : e.getValue()) {
View Full Code Here

    Directory taxoDir = newDirectory();
    SnapshotDirectoryTaxonomyWriter taxoWriter = new SnapshotDirectoryTaxonomyWriter(taxoDir);
    try {
      indexWriter.addDocument(newDocument(taxoWriter));
      indexWriter.commit();
      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"));
View Full Code Here

      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();
      assertNotNull(new IndexAndTaxonomyRevision(indexWriter, taxoWriter));
      rev1.release(); // this release should trigger the delete of segments_1
      assertFalse(indexDir.fileExists(IndexFileNames.SEGMENTS + "_1"));
    } finally {
      IOUtils.close(indexWriter, taxoWriter, taxoDir, indexDir);
View Full Code Here

    Directory taxoDir = newDirectory();
    SnapshotDirectoryTaxonomyWriter taxoWriter = new SnapshotDirectoryTaxonomyWriter(taxoDir);
    try {
      indexWriter.addDocument(newDocument(taxoWriter));
      indexWriter.commit();
      taxoWriter.commit();
      Revision rev = new IndexAndTaxonomyRevision(indexWriter, taxoWriter);
      Map<String,List<RevisionFile>> sourceFiles = rev.getSourceFiles();
      assertEquals(2, sourceFiles.size());
      for (List<RevisionFile> files : sourceFiles.values()) {
        String lastFile = files.get(files.size() - 1).fileName;
View Full Code Here

    Directory taxoDir = newDirectory();
    SnapshotDirectoryTaxonomyWriter taxoWriter = new SnapshotDirectoryTaxonomyWriter(taxoDir);
    try {
      indexWriter.addDocument(newDocument(taxoWriter));
      indexWriter.commit();
      taxoWriter.commit();
      Revision rev = new IndexAndTaxonomyRevision(indexWriter, taxoWriter);
      for (Entry<String,List<RevisionFile>> e : rev.getSourceFiles().entrySet()) {
        String source = e.getKey();
        Directory dir = source.equals(IndexAndTaxonomyRevision.INDEX_SOURCE) ? indexDir : taxoDir;
        for (RevisionFile file : e.getValue()) {
View Full Code Here

    Directory taxoDir = newDirectory();
    SnapshotDirectoryTaxonomyWriter taxoWriter = new SnapshotDirectoryTaxonomyWriter(taxoDir);
    try {
      indexWriter.addDocument(newDocument(taxoWriter));
      indexWriter.commit();
      taxoWriter.commit();
      Revision rev1 = new IndexAndTaxonomyRevision(indexWriter, taxoWriter);
      // releasing that revision should not delete the files
      rev1.release();
      assertTrue(slowFileExists(indexDir, IndexFileNames.SEGMENTS + "_1"));
      assertTrue(slowFileExists(taxoDir, IndexFileNames.SEGMENTS + "_1"));
View Full Code Here

      assertTrue(slowFileExists(taxoDir, IndexFileNames.SEGMENTS + "_1"));
     
      rev1 = new IndexAndTaxonomyRevision(indexWriter, taxoWriter); // create revision again, so the files are snapshotted
      indexWriter.addDocument(newDocument(taxoWriter));
      indexWriter.commit();
      taxoWriter.commit();
      assertNotNull(new IndexAndTaxonomyRevision(indexWriter, taxoWriter));
      rev1.release(); // this release should trigger the delete of segments_1
      assertFalse(slowFileExists(indexDir, IndexFileNames.SEGMENTS + "_1"));
    } finally {
      IOUtils.close(indexWriter, taxoWriter, taxoDir, indexDir);
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.