【问题标题】:SQL Server Fulltext search yields no resultsSQL Server 全文搜索不产生任何结果
【发布时间】:2010-05-06 13:36:47
【问题描述】:

我有带有高级服务的 SQL Server 2005 Express Edition。我启用了全文并创建了一个目录,如下所示:

create FullText catalog MyDatabase_FT in path 'mypath' as default

然后我创建了一个全文索引,如下所示:

create FullText index on Cell (CellName) key index PK_Cell
    with CHANGE_TRACKING AUTO

我执行了以下查询:

1) select count(*) from Cell where contains (CellName, 'CU*')
2) select count(*) from Cell where CellName like 'CU%'

并得到以下结果:

1) 0
2) 24

我意识到填充全文索引可能需要一些时间。然而,尽管有很多时间(12 小时),我仍然没有得到任何结果。然后我使用 ObjectPropertyEx() 函数进一步调查并执行了以下操作:

declare @id int
select @id = id FROM sys.sysobjects where [Name] = 'Cell'
select 'TableFullTextBackgroundUpdateIndexOn' as 'Property', objectpropertyex(@id, 'TableFullTextBackgroundUpdateIndexOn') as 'Value'
union select 'TableFullTextChangeTrackingOn', objectpropertyex(@id, 'TableFullTextChangeTrackingOn')
union select 'TableFulltextDocsProcessed', objectpropertyex(@id, 'TableFulltextDocsProcessed') 
union select 'TableFulltextFailCount', objectpropertyex(@id, 'TableFulltextFailCount') 
union select 'TableFulltextItemCount', objectpropertyex(@id, 'TableFulltextItemCount') 
union select 'TableFulltextKeyColumn', objectpropertyex(@id, 'TableFulltextKeyColumn') 
union select 'TableFulltextPendingChanges', objectpropertyex(@id, 'TableFulltextPendingChanges') 
union select 'TableHasActiveFulltextIndex', objectpropertyex(@id, 'TableHasActiveFulltextIndex') 

这给出了以下结果:

TableFullTextBackgroundUpdateIndexOn 1
TableFullTextChangeTrackingOn 1
TableFulltextDocs 已处理 11024
TableFulltextFailCount 0
TableFulltextItemCount 4038
TableFulltextKeyColumn 1
表FulltextPendingChanges 0
TableHasActiveFulltextIndex 1

然后我尝试按如下方式重新填充索引:

alter fulltext index on Cell start full population

我收到以下警告:

Warning: Request to start a full-text index population on table or indexed view 'Cell' is ignored because a population is currently active for this table or indexed view.

我尝试了如下更新人口:

alter fulltext index on Cell start update population

这返回:“命令成功完成。”,但是我仍然没有得到全文搜索的结果。

我错过了什么?我需要做什么才能使全文搜索正常工作?

谢谢,伊兰

【问题讨论】:

    标签: sql-server sql-server-2005 full-text-search full-text-indexing


    【解决方案1】:

    这一切都归结为搜索文本的格式。

    这是不正确的:

    select count(*) from Cell where contains (CellName, 'CU*')
    

    这是正确的:

    select count(*) from Cell where contains (CellName, '"CU*"')
    

    一切正常!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-09
      • 2018-07-17
      • 1970-01-01
      • 2019-08-20
      • 2014-02-21
      相关资源
      最近更新 更多