Examples of forceMerge()


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

    * byte-shuffling exercise to test.
    */
   public static void optimizeIndex(Directory dir) throws IOException {
      IndexWriterConfig indexWriterConfig = new IndexWriterConfig(LuceneSettings.LUCENE_VERSION, LuceneSettings.analyzer);
      IndexWriter iw = new IndexWriter(dir, indexWriterConfig);
      iw.forceMerge(1, true);
      iw.close();
   }

}
View Full Code Here

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

    * byte-shuffling exercise to test.
    */
   public static void optimizeIndex(Directory dir) throws IOException {
      IndexWriterConfig indexWriterConfig = new IndexWriterConfig(LuceneSettings.LUCENE_VERSION, LuceneSettings.analyzer);
      IndexWriter iw = new IndexWriter(dir, indexWriterConfig);
      iw.forceMerge(1, true);
      iw.close();
   }
  
   /**
    * Useful tool to debug the Lucene invocations into the directory;
View Full Code Here

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

        }
      } finally {
        releaseSearcher(indexSearcher);
      }
      if (fullMerge) {
        writer.forceMerge(1);
      }
      // close writer
      writer.close();
      // TODO: this isn't that great, maybe in the future SpellChecker should take
      // IWC in its ctor / keep its writer open?
View Full Code Here

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

    assertEquals(1, reader.getParallelTaxonomyArrays().parents().length);

    // add category and call forceMerge -- this should flush IW and merge segments down to 1
    // in ParentArray.initFromReader, this used to fail assuming there are no parents.
    writer.addCategory(new FacetLabel("1"));
    iw.forceMerge(1);
   
    // now calling openIfChanged should trip on the bug
    TaxonomyReader newtr = TaxonomyReader.openIfChanged(reader);
    assertNotNull(newtr);
    reader.close();
View Full Code Here

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

    TaxonomyReader reader = new DirectoryTaxonomyReader(writer);
    assertEquals(2, reader.getSize());
    assertEquals(2, reader.getParallelTaxonomyArrays().parents().length);

    // merge all the segments so that NRT reader thinks there's a change
    iw.forceMerge(1);
   
    // now calling openIfChanged should trip on the wrong assert in ParetArray's ctor
    TaxonomyReader newtr = TaxonomyReader.openIfChanged(reader);
    assertNotNull(newtr);
    reader.close();
View Full Code Here

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

    int size = 100;
    IndexReader[] readers = new IndexReader[size];
    for (int i = 0; i < size; i++) {
      writer.addDocument(getDoc());
      readers[i] = DirectoryReader.open(writer, true);
      writer.forceMerge(1);
    }

    try {
      for (int i = 0; i < size; i++) {
        checkReader(readers[i], i);
View Full Code Here

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

    IndexWriter writer = new IndexWriter(counter, conf);
    int size = 100;
    IndexReader[] readers = new IndexReader[size];
    for (int i = 0; i < size; i++) {
      writer.addDocument(getDoc());
      writer.forceMerge(1);
      readers[i] = DirectoryReader.open(writer, true);
    }

    for (int i = 0; i < size; i++) {
      assertEquals(i + 1, readers[i].numDocs());
View Full Code Here

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

        }

        for (GenericValue gv : contentList) {
            indexContent(dispatcher, delegator, context, gv, writer);
        }
        writer.forceMerge(1);
        writer.close();
    }

    public static void deleteContentDocument(GenericValue content, String path) throws Exception {
        Directory directory = FSDirectory.open(new File(getIndexPath(path)));
View Full Code Here

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

            }
            if (Debug.infoOn()) Debug.logInfo("Created new directory:" + directory.toString(), module);
        }

        indexContent(dispatcher, delegator, context, content, writer);
        writer.forceMerge(1);
        writer.close();
    }

    public static void indexContent(LocalDispatcher dispatcher, Delegator delegator, Map<String, Object> context, GenericValue content, IndexWriter writer) throws Exception {
        Document doc = ContentDocument.Document(content, context, dispatcher);
View Full Code Here

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

            writer  = new IndexWriter(directory, conf);
        } finally {
            IndexWriterConfig.setDefaultWriteLockTimeout(savedWriteLockTimeout);
        }
        indexDataResource(delegator, context, id, writer);
        writer.forceMerge(1);
        writer.close();
    }

    public static void indexDataResource(Delegator delegator, Map<String, Object> context, String id, IndexWriter writer) throws Exception {
        Document doc = DataResourceDocument.Document(id, delegator, context);
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.