zoukankan      html  css  js  c++  java
  • about lucene merepolicy

    above 3.2 version the default mergepolicy is used triedmergepolicy
    so if you want use setMergeFactor you must down the version use bellow code
             Directory dir = FSDirectory.open(new File(indexPath));
                Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_31);
                IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_31, analyzer);
    //            if (create) {
    //              // Create a new index in the directory, removing any
    //              // previously indexed documents:
    //              iwc.setOpenMode(OpenMode.CREATE);
    //            } else {
    //              // Add new documents to an existing index:
                  iwc.setOpenMode(OpenMode.CREATE_OR_APPEND);
                  
                  MergePolicy mp=iwc.getMergePolicy();
                  if (mp instanceof LogMergePolicy)
                  {
                    LogMergePolicy lmp=(LogMergePolicy) mp;
                    lmp.setMergeFactor(20);
                    System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
                  }
                  
                  //            }
                // Optional: for better indexing performance, if you
                // are indexing many documents, increase the RAM
                // buffer.  But if you do this, increase the max heap
                // size to the JVM (eg add -Xmx512m or -Xmx1g):
                //
                // iwc.setRAMBufferSizeMB(256.0);
                IndexWriter writer = new IndexWriter(dir, iwc);
                            
    //            writer.setMergeFactor(2);
    //            writer.deleteAll();
  • 相关阅读:
    jQuery 点击超链接生成一个的页面,点击几次,生成几个新页面
    Zookeeper基本信息
    性能测试基础
    Java安装及基础01
    手机抓包手册
    在linux环境下部署禅道环境
    Linux基础命令2
    Linux基础命令1
    SQL SERVER 基本操作语句
    MYSQL多表查询
  • 原文地址:https://www.cnblogs.com/lexus/p/2293943.html
Copyright © 2011-2022 走看看