zoukankan      html  css  js  c++  java
  • 关于Lucene.net

    使用方法就不多说了,网上一搜一大堆。

    我这里说的只要是在创建索引和查询索引的时候,分词器类型必须要保持一致!!!否则结果不正确会雷死你。

                Analyzer analyzer = null;
                //if (isPangu)
                
    //{
                
    //    analyzer = new PanGuAnalyzer();//盘古Analyzer
                
    //}
                
    //else
                
    //{
                analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);
                //}

      上面是创建时候用的。下面是查询时候。

            /// <summary>
            
    /// 构造常见的几种Analyzer列表
            
    /// </summary>
            
    /// <returns></returns>
            public static IList<Analyzer> BuildAnalyzers()
            {
                IList<Analyzer> listAnalyzer = new List<Analyzer>()
                {
                    new PanGuAnalyzer(),//盘古分词器  provide by eaglet http://pangusegment.codeplex.com/
                    
    //new StandardAnalyzer(Version.LUCENE_29),
                    
    //new WhitespaceAnalyzer(),
                    
    //new KeywordAnalyzer(),
                    
    //new SimpleAnalyzer(),
                    
    //new StopAnalyzer(Version.LUCENE_29),
                };
                return listAnalyzer;
            }

      根据自己的需要选择分词器。  

  • 相关阅读:
    hadoop balance
    随笔
    ubuntu server 使用parted分区
    程序员内功续
    hadoop——hdfs多硬盘挂载
    hdfs老数据压缩备份的一些问题20120521
    hadoop balance failed
    hoj 2524 Allocate Dormitories 二分图的最大匹配
    HDOJ 分类(转)
    hoj 3008 Matryoshka Dolls Again 最大独立子集
  • 原文地址:https://www.cnblogs.com/zhangpan1244/p/2569547.html
Copyright © 2011-2022 走看看