柚子Nan--回归原点

Everything can be as easy as you like or as complex as you need.
posts - 233, comments - 985, trackbacks - 17, articles - 29
  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理

Today I received a new task: create a simple aspx page using the Microsoft index server to query. I didn't use it before, so I firstly search some info with the help of google and codeproject website.

 

According to the resources on the internet, to create search pages and result pages there are two ways to do this. One is using use fairly simple IDQ and HTX files. The other one is using Asp.net with the help of ADO.Net.

 

With Index server, developers could query index server in the same manner that they would query a database.

 

Some important things to consider basically:

1 consider what document properties and meta-data the user can search

2 how those results are to be displayed.

3 to limit their search to a particular scope

4 how results are sorted and how many appear on a page

 

In fact, these four points are so simple to design. With the help of TextBox, Button, DataGrid control, you can do it easily. Here is my Demo code.

 

Before running the code, firstly you should configure the Index Service.

1. Click Start, and then click Control Panel.

2. Double-click Administrative Tools.

3. Click Computer management.

4. Expand Services and Applications.

 

The detailed operation steps is from Microsoft KB .

 

说了半天英文,好累。说说这个功能的核心,这句话“developers could query index server in the same manner that they would query a database”我最最关心了。什么意思呢?

 

1、按照与关系数据库相同的访问方式,那么数据库在哪里?

Data Source='" + strCatalog + "'";  // 就是数据源。

数据源的访问方式 Provider=MSIDXS.1;

strCatalog 就是你在Index Service 下看到的System, Web ,这个是操作系统已经建立好的目录,当然你还可以新建自己的Catalog,就相当于建立一个数据库。

2、查询什么,那么查询语句如何写呢。

看看定义的strQuery ,我的理解好像就是这个数据库里有1张表,有这些固定的字段,例如文件名、路径、大小等信息,使用了一个SQL Server自建的函数SCOPE()等等,谁有相关的详细资料,可以共享共享

string strCatalog,strQuery,connString   ;
                strCatalog 
= "TestCatalog"
;
                strQuery 
= "Select DocTitle,Filename,Size,PATH,URL from SCOPE() where FREETEXT('" +TextBox1.Text.Trim()+ "')"
;
                connString 
= "Provider=MSIDXS.1;Integrated Security .='';Data Source='" + strCatalog + "'"
;

                OleDbConnection1.ConnectionString 
=
 connString;
                OleDbDataAdapter OleDbDataAdapter1 
= new
 OleDbDataAdapter(strQuery,OleDbConnection1);


   

参考资料:

http://support.microsoft.com/kb/820105/EN-US/

http://support.microsoft.com/kb/308202

http://www.codeproject.com/aspnet/search.asp#xx982415xx

Feedback

#1楼 [楼主]   回复  引用  查看    

2005-03-08 15:51 by 柚子Nan      
欢迎熟悉或者对于Index Server感兴趣的朋友关注
下边的内容纯属备忘:
doctitle: The page title (as specified in the <TITLE>...</TITLE> element)
vpath : The Virtual path to the page
size : The size of the page
characterization : A description of the page
rank : A value specifying how well the page matches the search criteria

#2楼    回复  引用    

2005-03-08 20:56 by 不至于 [未注册用户]
Guy,very good!
Begin to use English,hhe。

#3楼    回复  引用  查看    

2005-03-10 16:51 by 挥辉      
hello,buddy,how about your new job? Is everything OK?Keeping touch with All of your friends:)Good Luck!

#4楼 [楼主]   回复  引用  查看    

2005-03-10 19:57 by 柚子男      
ok,
Everything goes smoothly,but overtime-work can't be payed.

#5楼    回复  引用  查看    

2005-03-11 09:11 by 挥辉      
To be care for your health,you should keep the enough time about sleep and rest,hehe.everything will go smoothly,everything is better than before.

#6楼 [楼主]   回复  引用  查看    

2005-03-18 14:54 by 柚子男      
不忍心删除的一些经验,就放在这里了;
1、编录一定要存放在需要索引的目录之外,尤其是IIS的服务目录之外;
2、在使用INDEX SERVER前,一定要保存以下IIS的设置,以备日后恢复;
3、索引服务需要使用SYSTEM帐户的权限,没有该级别的权限,则索引服务无法索引文件;
4、索引服务不会为加密文件索引,如果是索引以后再加密,也将被索引服务删除。
5、提供索引服务的时候,不要执行防毒或备份 软件 ,因为这类程序会锁定文件,而导致索引服务在建立索引或更新的时候超时。
6、索引服务在默认状态下,当用户对磁盘有操作的时候,将会暂时停止,可以停止服务,调整性能-->自定义-->索引:立即,可以改变这种状况,当然系统资源也会因此会被占用更多。
7、在查询中进行较好的设置,为用户提供友好的界面,提高查询的准确度,降低查询对系统资源的占用率。

#7楼    回复  引用    

2005-03-23 21:36 by CsOver [未注册用户]
Now,I am interesting in other dotnet.This I will study future.ing!




标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2005-03-08 15:47 编辑过
Google站内搜索

相关文章:

相关链接:

历史上的今天:
2004-03-08 共享一本好书