开发者

SQL Server Fulltext search yields no results

I have SQL Server 2005 Express Edition with Advanced Services. I enabled FullText and created a catalog as follows:

create FullText catalog MyDatabase_FT in path 'mypath' as default

I then created a FullText index as follows:

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

I executed the following queries:

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

And got the following results:

1) 0

2) 24

I realize that it could take some time to populate the FullText indexes. However, despite much time (12 hours) I still get no results. I then investigated further using the ObjectPropertyEx() function and executed the following:

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') 

This gave the follo开发者_如何学编程wing results:

TableFullTextBackgroundUpdateIndexOn 1

TableFullTextChangeTrackingOn 1

TableFulltextDocsProcessed 11024

TableFulltextFailCount 0

TableFulltextItemCount 4038

TableFulltextKeyColumn 1

TableFulltextPendingChanges 0

TableHasActiveFulltextIndex 1

I then tried to do a fresh full population of the index as follows:

alter fulltext index on Cell start full population

And I get the following warning:

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.

I tried an update population as follows:

alter fulltext index on Cell start update population

This returned: "Command(s) completed successfully.", however I still get no results on the FullText search.

What am I missing? What do I need to do to get the FullText search working?

Thanks, Elan


Well it all boiled down to the formatting of the search text.

This was incorrect:

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

This was correct:

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

Everything is working fine!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜