Examples of forceMerge()


Examples of org.apache.lucene.index.BlurIndexWriter.forceMerge()

      @Override
      public void run() {
        try {
          waitUntilNotNull(_writer);
          BlurIndexWriter writer = _writer.get();
          writer.forceMerge(numberOfSegmentsPerShard, true);
          _writeLock.lock();
          try {
            commit();
          } finally {
            _writeLock.unlock();
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.forceMerge()

        doc.add(new TextField("Sweden", swedenAnalyzer.tokenStream("Sweden", sortData[i][4])));
      if (sortData[i][5] != null)
        doc.add(new TextField("Denmark", denmarkAnalyzer.tokenStream("Denmark", sortData[i][5])));
      writer.addDocument(doc);
    }
    writer.forceMerge(1);
    writer.close();
    IndexReader reader = DirectoryReader.open(indexStore);
    IndexSearcher searcher = new IndexSearcher(reader);

    Sort sort = new Sort();
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.forceMerge()

    Directory d = new MockDirectoryWrapper(random, new RAMDirectory());
    IndexWriter w = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)));
    for (int i = 0; i < numDocs; i++) {
      w.addDocument(new Document());
    }
    w.forceMerge(1);
    w.commit();
    w.close();
    DirectoryReader reader = DirectoryReader.open(d);
    return new AllDeletedFilterReader(LuceneTestCase.getOnlySegmentReader(reader));
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.forceMerge()

    DecimalFormat df = new DecimalFormat(DynamicTimeRangeFacetHandler.NUMBER_FORMAT);
    for (long l = 0; l < 53; l++) {
      Document d = new Document();
      d.add(buildMetaField("timeinmillis", df.format(now - l * 3500000)));
      idxWriter.addDocument(d);
      idxWriter.forceMerge(1);
      idxWriter.commit();
    }
    idxWriter.close();
    DirectoryReader idxReader = DirectoryReader.open(idxDir);
    BoboMultiReader boboReader = BoboMultiReader.getInstance(idxReader, facetHandlers);
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.forceMerge()

    doc = new Document();
    doc.add(newTextField("zzz", "bar", Field.Store.YES));
    writer.addDocument(doc);

    writer.forceMerge(1);
    writer.close();
  }

  @Override
  public void tearDown() throws Exception {
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.forceMerge()

    writer.commit();
    addDocs2(writer, 10);
    writer.commit();
    assertEquals(30, writer.maxDoc());
    _TestUtil.checkIndex(dir);
    writer.forceMerge(1);
    assertEquals(30, writer.maxDoc());
    writer.close();
    dir.close();
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.forceMerge()

    assertEquals(40, writer.maxDoc());

    if (VERBOSE) {
      System.out.println("TEST: now optimize");
    }
    writer.forceMerge(1);
    assertEquals(40, writer.maxDoc());
    writer.close();
    assertQuery(new Term("content", "ccc"), dir, 10);
    assertQuery(new Term("content", "bbb"), dir, 20);
    assertQuery(new Term("content", "aaa"), dir, 10);
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.forceMerge()

          doc.add(field);
        }
        writer.addDocument(doc);
      }
      if (random().nextBoolean()) {
        writer.forceMerge(1);
      }
      writer.commit();
      assertEquals((i + 1) * docsPerRound, writer.maxDoc());
      writer.close();
    }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.forceMerge()

    iw.close();
    verify(dir);
    _TestUtil.checkIndex(dir); // for some extra coverage, checkIndex before we forceMerge
    iwc.setOpenMode(OpenMode.APPEND);
    IndexWriter iw2 = new IndexWriter(dir, iwc.clone());
    iw2.forceMerge(1);
    iw2.close();
    verify(dir);
    dir.close();
  }
 
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.forceMerge()

  public void tearDown() throws Exception {
    iw.close();
    _TestUtil.checkIndex(dir); // for some extra coverage, checkIndex before we forceMerge
    iwc.setOpenMode(OpenMode.APPEND);
    IndexWriter iw = new IndexWriter(dir, iwc.clone());
    iw.forceMerge(1);
    iw.close();
    dir.close(); // just force a checkindex for now
    super.tearDown();
  }
 
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.