当前位置: 移动技术网 > IT编程>开发语言>.net > 全文本检索的应用(1)

全文本检索的应用(1)

2019年01月13日  | 移动技术网IT编程  | 我要评论

没离开过 席琳迪翁,自动化就业前景,桂林个人二手房网

基本知识
1. sql server(windows平台上强大的平台)7 的 desktop 版中没有全文本检索。
2. 一个表只能有一个全文本检索。
3. 被检索的表必须有单列的唯一索引。
4. 全文本的索引存储在文件中,而非数据库中。
5. 更新全文本索引的过程比常规索引要耗时,而且也不象常规索引那样可以由数据库系统立即更新。
6. 全文本索引包含在全文本目录( full-text catalog )中,每个数据库可以包含一个或多个目录,但一个目录不能属于多个数据库。
7. 全文本检索只能在真正的表上创建,不能是视图,系统表,临时表。
8. 全文本检索会忽略某些噪音字( noise words),比如英文的 a,the,and,中文的和,是等等。
9. 如果在查询中包含 noise words ,就会引发错误,在应用程序中应去除这些 noise words。

启动全文本检索服务。
方法a:在企业管理器中打开 support services 文件夹,在 full-text search 的右键菜单中选择 start。
方法b:在 sql server(windows平台上强大的数据库平台) service manager 的 services 下拉列表中选择 microsoft search,并单击 start/continue 按钮。
方法c:使用 net start mssearch 的命令行方式。
使用全文本检索向导( full-text indexing wizard )。
step1. 选择被检索的数据库,在 tools 的菜单中,选择 full-text indexing,进入欢迎( welcome )的屏幕,单击 next。
step2. 选择被检索的表,单击 next。
step3. 选择唯一索引,单击 next。
step4. 选择被索引的列,单击 add,该列显示在右栏中。单击 next。
step5. 选择目录(选择已存在的目录,或创建新的目录),单击 next。
step6. 选择或创建 population schedule(可选项),单击 next。
step7. 单击 finish。
使用 sql-dmo (以 vb 为例)
step1. 在工程的引用中选择 microsoft sqldmo object library。
step2. 创建 sqlserver 对象。
dim objsql as new sqldmo.sqlserver
objsql.connect "localhost", "sa", ""
step3. 创建新的目录,并加入到被索引的数据库目录中。
dim objcatalog as new sqldmo.fulltextcatalog
使 pubs 为全文本检索的数据库
objsql.databases("pubs").enablefulltextcatalogs
创建新的目录
objcatalog.name = "ftcpubstest"
将新目录加入到目录集合中
objsql.databases("pubs").fulltextcatalogs.add objcatalog
step4. 在表上创建全文本索引。
dim objtable as new sqldmo.table
指定被索引的表
set objtable = objsql.databases("pubs").tables("authors")
指定目录名和唯一索引名
objtable.fulltextcatalogname = "ftcpubstest"
objtable.uniqueindexforfulltext = "upkcl_auidind"
objtable.fulltextindex = true

指定被索引的列
objtable.columns("au_lname").fulltextindex = true
objtable.columns("au_fname").fulltextindex = true

激活该表上的全文本索引
objtable.fulltextindexactive = true

step5. 启动全文本目录
objcatalog.start sqldmofulltext_full
使用存储过程
step1. 使 pubs 为全文本检索的数据库
use pubs
go
sp_fulltext_database enable

step2. 创建新的目录
sp_fulltext_catalog ftcpubstest,create
step3. 指定被索引的表
sp_fulltext_table authors,create,ftcpubstest,upkcl_auidind
step4. 指定被索引的列
sp_fulltext_column authors,au_lname,add
sp_fulltext_column authors,au_fname,add
step5. 激活该表上的全文本索引
sp_fulltext_table authors,activate
step6. 启动全文本目录
sp_fulltext_catalog ftcpubstest,start_full

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网