2

我有带有高级服务的 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 TableFulltextDocsProcessed
11024 TableFulltextFailCount
0 TableFulltextItemCount
4038 TableFulltextKeyColumn
1 TableFulltextPendingChanges
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

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

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

谢谢, 艾伦

4

1 回答 1

4

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

这是不正确的:

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

这是正确的:

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

一切正常!

于 2010-05-06T13:43:00.587 回答