关于对sql2000查询结果进行相关度排序的测试

来源:互联网 发布:黑马程序员 android 编辑:程序博客网 时间:2024/05/21 09:26
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
sql2000的查询结果进行相关度排序,听起来好象很吸引人,不过真的是可以实现的。
    上午上网看到了一篇利用微软index server来做全文查询的文章(这个以前也看到过,在计算机管理中也自带了这样一个查询功能)
我的IIS默认web服务器在g:/wwwroot下其中有10万多的html文档
   测试:strSearch = "SELECT DocTitle, Path, FileName, Characterization, Size,write,RANK" & _
" FROM SCOPE()" & _
" WHERE CONTAINS ('" & Request.Form("txtSearchFor") & "') ORDER BY RANK  desc" 还进行了相关度的排序,我没有做时间的具体开销
的计算,不过给人的感觉还可以接受,在翻页的时候就非常快了。不过最大的缺点好象就是只能索引静态页面了。
   下午我把以前的一个50多万条记录(主要是歌曲名和歌手名)的数据库在sql2000做了索引,晚上就可以开始测试了。
   测试一: "select top 26 * from song1 where contains(songtitle,'爱')",对结果没有进行任何的处理,只是按照ID的升续排列
时间开销基本上维持在0.016s,速度是很让人满意的,至少感觉不到慢。

   测试二:利用rank值进行了相关度的排序,"order by rank desc" or "order by rank asc",查询结果在排序的质量上让人满意,都比较
准确的,不管是查询时使用 or 或者and进行多关键字的排序都还可以的,不过时间的开销让我受不了,居然在6s到8s之间,
而且cpu也占用比较高
   我看到网上其他的搜索的相关度排序都比较快的,开源的Lucene我没有研究过,因为我不懂java。
不过我想如果在索引的时候对每个关键字进行相关度的运算查询起来应该不会慢的啊,这个我也感到郁闷。转自:动态网制作指南 www.knowsky.com<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>