Indexing Service simple sample
来源:互联网 发布:musixmatch for mac 编辑:程序博客网 时间:2024/05/20 04:15
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
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进行设置和管理的编程对象: 下面是通过IndexingService进行全文搜索的编程对象: 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.
在msdn的文档中提供了一些比较简单的示例代码,分别由VBScript, JScript, Visual Basic, Visual C++, 和Visual J++的代码,好像没有.NET的代码。
需要添加com引用
Interop.CIODMLib.dll
Interop.Cisso.dll
可用object browser查看里面的类
try
{
Cisso.CissoQueryClass query = new Cisso.CissoQueryClass();
query.Columns = "Filename,Path,Size";
query.Query = tbKeywords.Text;
//query.CiScope = "";
query.Catalog = "Web";// "testCatalog";
OleDbDataAdapter sda = new OleDbDataAdapter();
DataTable dtResult = new DataTable();
sda.Fill(dtResult, query.CreateRecordset("nonsequential"));
{
Cisso.CissoQueryClass query = new Cisso.CissoQueryClass();
query.Columns = "Filename,Path,Size";
query.Query = tbKeywords.Text;
//query.CiScope = "";
query.Catalog = "Web";// "testCatalog";
OleDbDataAdapter sda = new OleDbDataAdapter();
DataTable dtResult = new DataTable();
sda.Fill(dtResult, query.CreateRecordset("nonsequential"));
//dtResult.Columns[
gvResult.DataSource = dtResult;
gvResult.DataBind();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
gvResult.DataSource = dtResult;
gvResult.DataBind();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
private DataTable GetIndexingServiceSearchResult()
{
{
Cisso.CissoQueryClass q = new Cisso.CissoQueryClass();
Cisso.CissoUtilClass util = new Cisso.CissoUtilClass();
OleDbDataAdapter da = new OleDbDataAdapter();
DataTable dt = new DataTable();
Cisso.CissoUtilClass util = new Cisso.CissoUtilClass();
OleDbDataAdapter da = new OleDbDataAdapter();
DataTable dt = new DataTable();
q.Query = tbKeywords.Text;
q.Catalog = FullTextSearchCatalog;
q.SortBy = "Filename";
q.Columns = "Filename,Path,Size";
util.AddScopeToQuery(q, FullTextSearchScope, "deep");
q.Catalog = FullTextSearchCatalog;
q.SortBy = "Filename";
q.Columns = "Filename,Path,Size";
util.AddScopeToQuery(q, FullTextSearchScope, "deep");
da.Fill(dt, q.CreateRecordset("nonsequential"));
return dt;
return dt;
}
- Indexing Service simple sample
- Simple Windows Service Sample
- Simple Windows Service Sample
- Indexing Service查询
- Indexing Service 索引服务
- Indexing service--OpenQuery
- 摘要:Indexing Service - OpenQuery()
- [Simple Factory]:Source Sample
- a simple jsm sample
- A simple Hibernate sample
- A simple mysql sample
- C++ simple sample IOCP
- django simple sample
- Sql Sample(simple)
- Django simple sample
- Microsoft Indexing Service 相关资料
- What is the Indexing Service?
- Local Service Sample & Remote Messenger Service Sample
- spring源码下载及与myeclipse集成阅读
- version `GLIBCXX_3.4.9' not found
- audio
- 学习技术的几个境界
- 项目中编译后的jsp文件放置的位置
- Indexing Service simple sample
- SQLServer 2000 y 2005 con Dinamica....
- Mysql注入详解
- Java访问权限修饰符friendly----同一个包内其它类可以访问(钦波总结大全)(转http://huiqinbo.javaeye.com/blog/577956)
- RtlSetProcessIsCritical 介绍
- Android开发之旅:应用程序基础及组件
- opencv中通道的理解
- vb activeX控件利用Inet控件发送HTTP请求
- strlen("汉字")的值是多少