sql 7的全文检索和index server的检索方式非常类似。
contains
and, or, not
可以在contains中很方便使用逻辑表达式
example:
select username from member where contains(userinfo,'"作家" and "木匠"')
select username from member where contains(userinfo,'"作家" or "木匠"')
select username from member where contains(userinfo,'"作家" and not "木匠"')
near
这是一个在普通的逻辑表达式中没有的关键字,意思是很简单,就是说找到靠近的两个词
example:
select content from microsoftrecord where contains(content,'"比尔·盖茨" near "保罗·艾伦"')
这就表示要找到全文中包含比尔·盖茨和保罗·艾伦,并且两个词相隔不远。
formsof inflectional
这个功能可以查找单词的各种形式,比如过去式、复数、动词形式、名词形式等。可惜对中文没什么用
example:
select productname from products where contains(productname,'formsof (inflectional, dry)')
*
这个功能可以查找单词的前缀,不过对中文也没有什么用处
example:
select productname from products where contains(productname, '"dis*"')
isabout weight
这个功能可以给复合查询时不同的条件以不同的权重,以决定返回的记录集的顺序
select categoryname, description from categories where contains(description, 'isabout spread weight (.8), sauces weight (.4), relishes weight (.2) )' )
权重的值可以从0.0到1.0
containstable
它的使用方式和contains基本相同,这里就不再重复介绍了。要提到的是它返回的是一张供你进一步查询的表,而不是一个查询条件。
freetext
如果使用这种方式,那么查询的时候会使用分词技术来实现模糊查询,并且过滤掉一些非关键词,比较类似于contains中的formsof,可惜对中文也没有什么支持
example:
select categoryname from categories where freetext (description, 'sweetest candy bread and dry meat' )
freetexttable
它和freetext的差别就跟contains和containstable的差别一样。
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
安卓10
SQLite数据库存储Android系统竟然是内置了数据库的,SQLite 是散轻量级的关系型数据库,它的运算速...
[阅读全文]
-
-
-
-
-
-
-
-
安卓第六课
一:sqlite数据库简介SQLite是一个轻量级数据库,占用资源非常低,在内存中只需要占用几百KB的存储空间。...
[阅读全文]
-
-
事务的四大特性
事务的使用:事务就是用户定义的一系列执行SQL语句的操作, 这些操作要么完全地执行,要么完全地都不执行, 它是一...
[阅读全文]
网友评论