这两天一直在捣腾lucene

    开始看了下java的,弄不太明白,没学过java,后来找了了.net的,主要是研究下dotlucene,由于刚刚接触c#,对这样一个开源的项目研究还是有点困难,不过我比较喜欢搜索类的,所以还是看了起来,看了大量的资料,英文的和中文的,现在终于是调试成功了,而且加了一个基于词表的中文分词。
   现在还有Highlighter高亮显示的没弄出来,正在研究中!
     还有就是自己写的html2text,感觉效率不是很好,老是程序一运行程序就卡死!不知道什么原因

 1public string html2text(string content,string s,string e)
 2        {
 3            int s_pos=content.IndexOf (s);//查找开始字符串位置
 4            while(s_pos!=-1)
 5            {
 6                int e_pos=content.IndexOf (e,s_pos);//结束字符串位置
 7                if(e_pos!=-1)//如果存在结束字符串则进去替换处理
 8                {
 9                    string replacestr=content.Substring (s_pos,e_pos+e.Length-s_pos);//夹在开始和结束字符串之间的被替换字符
10                    content=content.Replace(replacestr,"");
11                    s_pos=content.IndexOf (s);
12                }

13            }

14            content=content.Replace("\n","");
15            content=content.Replace("\r",""); 
16            content=content.Replace(" ","");
17            content=content.Replace("    ","");//tab键过滤
18            //content=content.Replace(" ","");//空格过滤
19            return content;
20        }

 以前用VB写的感觉没这么卡的,可能也跟一边索引有关吧!

posted @ 2005-11-13 18:55  草屋主人  阅读(771)  评论(0编辑  收藏  举报