Sql server SQL Server全文搜索不产生任何结果
我有SQL Server 2005 Express Edition和高级服务。我启用了全文并创建了一个目录,如下所示:Sql server SQL Server全文搜索不产生任何结果,sql-server,sql-server-2005,full-text-search,full-text-indexing,Sql Server,Sql Server 2005,Full Text Search,Full Text Indexing,我有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 alter fulltext index on Cell star
create FullText catalog MyDatabase_FT in path 'mypath' as default
create FullText index on Cell (CellName) key index PK_Cell
with CHANGE_TRACKING AUTO
alter fulltext index on Cell start full population
alter fulltext index on Cell start update population
然后,我创建了一个全文索引,如下所示:
create FullText catalog MyDatabase_FT in path 'mypath' as default
create FullText index on Cell (CellName) key index PK_Cell
with CHANGE_TRACKING AUTO
alter fulltext index on Cell start full population
alter fulltext index on Cell start update population
我执行了以下查询:
1) select count(*) from Cell where contains (CellName, 'CU*')
2) select count(*) from Cell where CellName like 'CU%'
并得到以下结果:
1) 02) 二十四 我意识到填充全文索引可能需要一些时间。然而,尽管花了很多时间(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 1TableFullTextChangeTrackingOn 1
TableFulltextDocsProcessed 11024
TableFulltextFailCount 0
TableFulltextItemCount 4038
TableFulltextKeyColumn 1
TableFulltextPendingChanges 0
TableHasActiveFulltextIndex 1 然后,我尝试对该指数进行新的全面分析,如下所示:
create FullText catalog MyDatabase_FT in path 'mypath' as default
create FullText index on Cell (CellName) key index PK_Cell
with CHANGE_TRACKING AUTO
alter fulltext index on Cell start full population
alter fulltext index on Cell start update population
我得到以下警告:
警告:对表或索引视图“单元格”启动全文索引填充的请求被忽略,因为此表或索引视图的填充当前处于活动状态。
我尝试了如下更新总体:
create FullText catalog MyDatabase_FT in path 'mypath' as default
create FullText index on Cell (CellName) key index PK_Cell
with CHANGE_TRACKING AUTO
alter fulltext index on Cell start full population
alter fulltext index on Cell start update population
这返回:“命令已成功完成”。但是,我在全文搜索中仍然没有得到任何结果
我错过了什么?我需要做什么才能让全文搜索正常工作
谢谢,Elan,这一切都归结为搜索文本的格式问题 这是不正确的:
select count(*) from Cell where contains (CellName, 'CU*')
这是正确的:
select count(*) from Cell where contains (CellName, '"CU*"')
一切正常