Java 类org.apache.lucene.index.NoMergeScheduler 实例源码

项目:es-token-plugin    文件:AllTermsTests.java   
@Before
public void initSearcher() throws IOException {
    dir = newDirectory();
    IndexWriterConfig indexWriterConfig = newIndexWriterConfig(new WhitespaceAnalyzer());
    indexWriterConfig.setMergeScheduler(NoMergeScheduler.INSTANCE);
    indexWriterConfig.setMergePolicy(NoMergePolicy.INSTANCE);
    w = new IndexWriter(dir, indexWriterConfig);
    Document d = new Document();
    d.add(new TextField(FIELD, "don't  be", Field.Store.YES));
    d.add(new TextField("_uid", "1", Field.Store.YES));
    w.addDocument(d);
    w.commit();
    d = new Document();
    d.add(new TextField(FIELD, "ever always forget  be", Field.Store.YES));
    d.add(new TextField("_uid", "2", Field.Store.YES));
    w.addDocument(d);
    w.commit();
    d = new Document();
    d.add(new TextField(FIELD, "careful careful", Field.Store.YES));
    d.add(new TextField("_uid", "3", Field.Store.YES));
    w.addDocument(d);
    w.commit();
    d = new Document();
    d.add(new TextField(FIELD, "ever always careful careful don't be forget be", Field.Store.YES));
    d.add(new TextField("_uid", "4", Field.Store.YES));
    w.addDocument(d);
    w.commit();
    reader = DirectoryReader.open(w, true, true);
}
项目:sagetv    文件:Wizard.java   
private void reloadIndex() {
  Directory diskDir;
  try {
    synchronized (getLock()) {
      initializedIndex = false;
      if(!diskIndex) {
        resetIndex();
        return;
      }
      index = new MMapDirectory(directorySnapshot, NoLockFactory.getNoLockFactory());
      IndexWriterConfig iwc = new IndexWriterConfig(org.apache.lucene.util.Version.LUCENE_36,
          analyzer).setOpenMode(OpenMode.CREATE_OR_APPEND);
      if (diskIndexRunning) {
        iwc.setRAMBufferSizeMB(INDEX_RAM_BUFFER_SIZE)
        .setMergePolicy(NoMergePolicy.NO_COMPOUND_FILES) // TESTING
        .setMergeScheduler(NoMergeScheduler.INSTANCE); // TETING
      }
      writer = new IndexWriter(index, iwc);
      initializedIndex = (writer.numDocs() > 0) ? true : false;
      reader = IndexReader.open(getWriter(), true); /* true: apply all deletes (perfhit) */
      searcher = new IndexSearcher(reader);
      needsReset = false;
    }
  } catch (IOException e) {
    System.out.println("Execption reloading index from disk; assuming corrupt. e = " + e);
    e.printStackTrace();
    resetIndex();
  }
}
项目:search    文件:CreateIndexTaskTest.java   
public void testNoMergeScheduler() throws Exception {
  PerfRunData runData = createPerfRunData(null);
  runData.getConfig().set("merge.scheduler", NoMergeScheduler.class.getName());
  new CreateIndexTask(runData).doLogic();
  new CloseIndexTask(runData).doLogic();
}
项目:NYBC    文件:CreateIndexTaskTest.java   
public void testNoMergeScheduler() throws Exception {
  PerfRunData runData = createPerfRunData(null);
  runData.getConfig().set("merge.scheduler", NoMergeScheduler.class.getName());
  new CreateIndexTask(runData).doLogic();
  new CloseIndexTask(runData).doLogic();
}
项目:Maskana-Gestor-de-Conocimiento    文件:CreateIndexTaskTest.java   
public void testNoMergeScheduler() throws Exception {
  PerfRunData runData = createPerfRunData(null);
  runData.getConfig().set("merge.scheduler", NoMergeScheduler.class.getName());
  new CreateIndexTask(runData).doLogic();
  new CloseIndexTask(runData).doLogic();
}