Package org.apache.lucene.index

Examples of org.apache.lucene.index.LogByteSizeMergePolicy


            directoryManager.delete(migrationName);
        }

        Directory migrationDir = directoryManager.getDirectory(migrationName);
        final IndexWriterConfig c = new IndexWriterConfig(Version.LUCENE_36, new JackrabbitAnalyzer());
        c.setMergePolicy(new UpgradeIndexMergePolicy(new LogByteSizeMergePolicy()));
        c.setIndexDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy());
        try {
            IndexWriter writer = new IndexWriter(migrationDir, c);
            try {
                IndexReader r = new MigrationIndexReader(IndexReader.open(index.getDirectory()),
View Full Code Here


            indexReader = null;
        }
        if (indexWriter == null) {
            IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_36, analyzer);
            config.setSimilarity(similarity);
            LogMergePolicy mergePolicy = new LogByteSizeMergePolicy();
            mergePolicy.setUseCompoundFile(useCompoundFile);
            mergePolicy.setNoCFSRatio(1.0);
            config.setMergePolicy(mergePolicy);

            indexWriter = new IndexWriter(getDirectory(), config);
            indexWriter.setInfoStream(STREAM_LOGGER);
        }
View Full Code Here

            indexReader = null;
        }
        if (indexWriter == null) {
            IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_36, analyzer);
            config.setSimilarity(similarity);
            LogMergePolicy mergePolicy = new LogByteSizeMergePolicy();
            mergePolicy.setUseCompoundFile(useCompoundFile);
            mergePolicy.setNoCFSRatio(1.0);
            config.setMergePolicy(mergePolicy);

            indexWriter = new IndexWriter(getDirectory(), config);
            indexWriter.setInfoStream(STREAM_LOGGER);
        }
View Full Code Here

   
    // hold onto IW to forceMerge
    // note how we don't close it, since DTW will close it.
    final IndexWriter iw = new IndexWriter(dir,
        new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()))
            .setMergePolicy(new LogByteSizeMergePolicy()));
    DirectoryTaxonomyWriter writer = new DirectoryTaxonomyWriter(dir) {
      @Override
      protected IndexWriter openIndexWriter(Directory directory,
          IndexWriterConfig config) throws IOException {
        return iw;
View Full Code Here

   
    // hold onto IW to forceMerge
    // note how we don't close it, since DTW will close it.
    final IndexWriter iw = new IndexWriter(dir,
        new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()))
            .setMergePolicy(new LogByteSizeMergePolicy()));
    DirectoryTaxonomyWriter writer = new DirectoryTaxonomyWriter(dir) {
      @Override
      protected IndexWriter openIndexWriter(Directory directory,
          IndexWriterConfig config) throws IOException {
        return iw;
View Full Code Here

    // Make sure we use a MergePolicy which always merges adjacent segments and thus
    // keeps the doc IDs ordered as well (this is crucial for the taxonomy index).
    return new IndexWriterConfig(Version.LUCENE_43,
        null).setOpenMode(openMode).setMergePolicy(
        new LogByteSizeMergePolicy());
  }
View Full Code Here

            indexReader = null;
        }
        if (indexWriter == null) {
            IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_36, analyzer);
            config.setSimilarity(similarity);
            LogMergePolicy mergePolicy = new LogByteSizeMergePolicy();
            mergePolicy.setUseCompoundFile(useCompoundFile);
            mergePolicy.setNoCFSRatio(1.0);
            config.setMergePolicy(mergePolicy);

            indexWriter = new IndexWriter(getDirectory(), config);
            indexWriter.setInfoStream(STREAM_LOGGER);
        }
View Full Code Here

   * we need to override the MergeScheduler to handle background errors, and a new instance needs to be created for each
   * new IndexWriter.
   * Also each new IndexWriter needs a new MergePolicy.
   */
  private IndexWriter createNewIndexWriter() throws IOException {
    LogByteSizeMergePolicy newMergePolicy = indexParameters.getNewMergePolicy(); //TODO make it possible to configure a different policy?
    writerConfig.setMergePolicy( newMergePolicy );
    MergeScheduler mergeScheduler = new ConcurrentMergeScheduler( this.errorHandler, this.indexName );
    writerConfig.setMergeScheduler( mergeScheduler );
    return new IndexWriter( directoryProvider.getDirectory(), writerConfig );
  }
View Full Code Here

   * new IndexWriter.
   * Also each new IndexWriter needs a new MergePolicy.
   */
  private IndexWriter createNewIndexWriter() throws IOException {
    final IndexWriterConfig indexWriterConfig = createWriterConfig(); //Each writer config can be attached only once to an IndexWriter
    LogByteSizeMergePolicy newMergePolicy = indexParameters.getNewMergePolicy(); //TODO make it possible to configure a different policy?
    indexWriterConfig.setMergePolicy( newMergePolicy );
    MergeScheduler mergeScheduler = new ConcurrentMergeScheduler( this.errorHandler, this.indexName );
    indexWriterConfig.setMergeScheduler( mergeScheduler );
    return new IndexWriter( directoryProvider.getDirectory(), indexWriterConfig );
  }
View Full Code Here

    /**
     * Creates a new LogByteSizeMergePolicy as configured by this property set.
     * @return a new LogByteSizeMergePolicy instance.
     */
    public LogByteSizeMergePolicy getNewMergePolicy() {
      LogByteSizeMergePolicy logByteSizeMergePolicy = new LogByteSizeMergePolicy();
      for ( Map.Entry<IndexWriterSetting, Integer> entry : parameters.entrySet() ) {
        try {
          entry.getKey().applySetting( logByteSizeMergePolicy, entry.getValue() );
        }
        catch (IllegalArgumentException e) {
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.LogByteSizeMergePolicy

Copyright © 2018 www.massapicom. 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.