Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > .NET > VB.NET > Windows Indexing Service的简单尝试
【标  题】:Windows Indexing Service的简单尝试
【关键字】:Windows,Indexing,Service
【来  源】:http://www.cnblogs.com/Laser_Lu/archive/2005/02/22/107314.html

Windows Indexing Service的简单尝试

Your Ad Here
昨天一个同事要了解Windows全文搜索的情况,无奈以前没用用过,所以昨天花了点时间对Indexing Service做了下简单的了解和编程尝试。

1.要使用Windows的全文搜索服务,首先要确保在“添加删除程序\添加删除Windows组件\”中安装了“索引服务”:

然后就可以使用Indexing Service了,包括进行编程。
安装了索引服务后就可以到“计算机管理\服务和应用程序\”中找到索引服务,并对之进行设置和管理:

默认情况下会有两个编目(Catalog),System和Web,分别用于建立和维护本地文件和本地网站的索引。每个编目包含了多个目录(Scope),并有一个属性(Property)集合。
 
2.关于Windows Indexing Service的相关文档、编程参考和代码片断都可以在msdn中找到,下面是链接:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/indexserv.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/indexsrv/html/ixrefobj_3skz.asp
 
3.由于IndexingService相关API都是通过COM组件的形式提供的,因此如果要在程序中调用相关API,就必须首先添加对如下Type Library的引用:
API Reference Library
Admin Helper Indexing Service Administration Type Library 1.0 CIODMLib
Query Helper ixsso Control Library Cisso
ADO Micorsoft ActiveX Data Objects (ADO) version Library, where version is one of the available versions. ADODB
下面是对Indexing Service进行设置和管理的编程对象:
Object name Description
AdminIndexServer Manages Indexing Service. Allows access to all the functionality provided by the Microsoft Management Console (MMC) snap-in.
CatAdm Manages the collection of scopes for a catalog.
ScopeAdm Manages an individual scope.
下面是通过IndexingService进行全文搜索的编程对象:
Object name Description
Query Manages the query definition and result-set creation and navigation.
Utility Helpful utilities for managing the queries and result sets.
msdn的文档中提供了一些比较简单的示例代码,分别由VBScript, JScript, Visual Basic, Visual C++, 和Visual J++的代码,好像没有.NET的代码。
 
4.如果是.NET环境下要使用Indexing Service同样是需要引用上面三个COM组件:

然后就可以在代码中通过Interop包装后的类来调用API了。下面是一段实现了简单搜索功能的示例代码:

完整的示例代码下载:http://phoebusd.mofile.com/4484472520119593/7410790504088141/2/0B459B9BE5C0E179512B394A987B482E/FulltextSearchSample.rar
 
程序的运行界面如下:

 
上面只是简单的了解了一下Indexing Service,并且尝试编写了一个很简单的示例而已,欢迎大家交流并希望高手指教:)
 
书信用语“商祺”是的意思:【上一篇】
人生少走弯路的十条忠告(转):【下一篇】
【相关文章】
  • 提升Web Services性能原来不是通过传说中的压缩Soap请求和响应消息来实现的
  • Windows Workflow Foundation(WWF)的学习资源-101
  • [Article]English presentation :Introduce an interesting product & service
  • 试用 Microsoft Windows AntiSpyware (Beta)
  • Windows Form中事件的激发顺序
  • Windows Form编程中的Command模式
  • Windows Form编程中的MVC
  • 修改Windows 2003 的默认上传文件大小!
  • Windows 2000 Server 服务器被入侵。
  • Windows1.0的软件趣闻【ZZ】
  • 【随机文章】
  • .net身份验证和授权
  • Photoshop CS2新增的变形转换体验
  • [转载]构造自己的数据包(实现破网关上QQ)
  • The code to detect a tcp port
  • 使用TreeViewer取代TableTreeViewer
  • MRTG交换机各端口当前流量排序scripts
  • 破解 Audio Companion 1.14(1)
  • 利用TCP暗藏通道绕过防火墙
  • 在windows平台安装cgicc(With Dev-CPP)
  • 快速升级路由器固件
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.