这两天一直在捣腾lucene
开始看了下java的,弄不太明白,没学过java,后来找了了.net的,主要是研究下dotlucene,由于刚刚接触c#,对这样一个开源的项目研究还是有点困难,不过我比较喜欢搜索类的,所以还是看了起来,看了大量的资料,英文的和中文的,现在终于是调试成功了,而且加了一个基于词表的中文分词。
现在还有Highlighter高亮显示的没弄出来,正在研究中!
还有就是自己写的html2text,感觉效率不是很好,老是程序一运行程序就卡死!不知道什么原因
1
public 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
}
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
3
![](/Images/OutliningIndicators/InBlock.gif)
4
![](/Images/OutliningIndicators/InBlock.gif)
5
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
6
![](/Images/OutliningIndicators/InBlock.gif)
7
![](/Images/OutliningIndicators/InBlock.gif)
8
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
9
![](/Images/OutliningIndicators/InBlock.gif)
10
![](/Images/OutliningIndicators/InBlock.gif)
11
![](/Images/OutliningIndicators/InBlock.gif)
12
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
13
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
14
![](/Images/OutliningIndicators/InBlock.gif)
15
![](/Images/OutliningIndicators/InBlock.gif)
16
![](/Images/OutliningIndicators/InBlock.gif)
17
![](/Images/OutliningIndicators/InBlock.gif)
18
![](/Images/OutliningIndicators/InBlock.gif)
19
![](/Images/OutliningIndicators/InBlock.gif)
20
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
以前用VB写的感觉没这么卡的,可能也跟一边索引有关吧!
新浪微博:http://t.sina.com.cn/sunli1223