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();
  • 相关阅读:
    Linux .o a .so .la .lo的区别
    linux源码Makefile详解
    Kconfig详解
    如何将驱动程序静态编译进内核
    getpeername
    Socket programming in C on Linux | tutorial
    C Socket Programming for Linux with a Server and Client Example Code
    UDP protocol
    TCP protocol
    How to learn linux device driver
  • 原文地址:https://www.cnblogs.com/lexus/p/2293943.html
Copyright © 2011-2022 走看看