baidu google搜索,关键词: 全文检索 中文

解决方案 »

  1.   

    一个完整的例子:前提条件:安装好全文检索服务,并启动--建立表,插入数据,建立全文索引if ( (select count(*) from sysobjects where name = 'testft' and type = 'U') > 0)
    drop table testftcreate table testft(
     id int identity(1,1) constraint pk_testft primary key,
     title nvarchar(500),
     content nvarchar(2000)
    )insert into testft values ('This is title', 'this is content')
    insert into testft values ('My name is sqlserver', 'Hello, everyone')
    insert into testft values ('这里是标题','这里是内容')
    insert into testft values ('江西', '南昌')
    insert into testft values ('湖南', '长沙')
    insert into testft values ('河南', '郑州')execute sp_fulltext_database 'enable'execute sp_fulltext_catalog 'ft_testft', 'CREATE'execute sp_fulltext_table 'testft', 'CREATE', 'ft_testft', 'pk_testft'execute sp_fulltext_column 'testft', 'title', 'ADD'
    execute sp_fulltext_column 'testft', 'content', 'ADD'execute sp_fulltext_table 'testft', 'ACTIVATE'execute sp_fulltext_catalog 'ft_testft', 'START_FULL'--执行完以上语句,再执行以下语句
    --查询:declare @keyword varchar(50)
    set @keyword = '南'
    select * from testft
    select * from testft where contains(*, @keyword)
      

  2.   

    还是不对,如果是这样查询
    select * from testft
    select * from testft where contains(*, @keyword)
    全部数据都出来了
    如果是
    select * from testft where contains(*, @keyword)
    又没有结果,什么原因呢??
      

  3.   

    我做了大量的试验,发现并不是所有的单字都搜不出来,比如,鲁、卓、毅、承等等的很多字都可以单独搜出来,但是,南、昌等一些比较少的字不能单独搜出来。(我把noise.chs都已经清空了,并且打了sp3的补丁)   到底是什么原因呢?是不是sql的配置有什么问题?