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();
  • 相关阅读:
    .Net中通过反射技术的应用插件程序的开发入门
    html超链接button
    WCF 跨域 Http绑定
    在ASP.NET MVC中修改默认代码生成/支架模板
    使用Lambda表达式重构委托
    使用公用表表达式(CTE)简化嵌套SQL
    WCF同域动态绑定服务地址
    WCF 跨域TCP绑定
    Silverlight 基础收集
    WCF服务控制台托管方法(不使用配置文件)
  • 原文地址:https://www.cnblogs.com/lexus/p/2293943.html
Copyright © 2011-2022 走看看