我最近遇到了FREETEXT
搜索在我的存储过程中停止工作的问题。
SELECT ShowID
FROM Table
WHERE FREETEXT(Category, @Category)
这已经工作了几个月,直到今天。我一直在尝试一些事情然后唯一有效的方法是我进入我的全文目录并将其删除到Category
列,然后重新添加。
有没有其他人有这个问题,如果是,你知道为什么会这样吗?我们在几个表中的几个列上使用FREETEXT
,我担心在我们不知道的情况下它可能会发生在其他地方。
答案 0 :(得分:0)
我使用这些查询来监控全文索引的状态。 在第一个查询中,PopulateStatus应为“0 - 空闲”。 在第二个查询中,CrawlCompleted列应为“1”。
-- FullText Catalog Info
SELECT @@SERVERNAME ServerName
, DB_NAME() DB
, C.fulltext_catalog_id CatalogID
, C.name CatalogName
, C.path CatalogPath
, CONVERT(NVARCHAR(10), FULLTEXTCATALOGPROPERTY(C.name, 'PopulateStatus')) + ' - '
+ CASE FULLTEXTCATALOGPROPERTY(C.name, 'PopulateStatus')
WHEN 0 THEN 'Idle'
WHEN 1 THEN 'Full population in progress'
WHEN 2 THEN 'Paused'
WHEN 3 THEN 'Throttled'
WHEN 4 THEN 'Recovering'
WHEN 5 THEN 'Shutdown'
WHEN 6 THEN 'Incremental population in progress'
WHEN 7 THEN 'Building index'
WHEN 8 THEN 'Disk is full, paused'
WHEN 9 THEN 'Change tracking'
ELSE '** Unknown PopulateStatus Code **'
END PopulateStatus
, FULLTEXTCATALOGPROPERTY(C.name, 'IndexSize') CatalogSizeMB
, FULLTEXTCATALOGPROPERTY(C.name, 'ItemCount') ItemCount
, FULLTEXTCATALOGPROPERTY(C.name, 'UniqueKeyCount') UniqueKeyCount
, c.is_default IsDefaultCatalog
, c.is_accent_sensitivity_on IsAccentSensitive
, c.data_space_id DataSpaceID
, c.file_id FileID
, c.principal_id PrincipalID
FROM sys.fulltext_catalogs C
ORDER BY C.name;
-- FullText Indexed Table/View info
SELECT C.name CatalogName
, S.name FTItemSchema
, O.name FTItemName
, O.type_desc FTItemType
--, I.object_id
--, I.unique_index_id
, SI.name UniqueIndexName
--, I.fulltext_catalog_id
, I.is_enabled IsEnabled
, I.change_tracking_state_desc ChangeTracking
, I.has_crawl_completed CrawlCompleted
, I.crawl_type_desc CrawlType
, I.crawl_start_date CrawlStart
, I.crawl_end_date CrawlEnd
FROM sys.fulltext_indexes I
INNER JOIN sys.fulltext_catalogs C ON C.fulltext_catalog_id = I.fulltext_catalog_id
INNER JOIN sys.objects O ON O.object_id = I.object_id
INNER JOIN sys.schemas S ON S.schema_id = O.schema_id
INNER JOIN sys.indexes SI ON SI.object_id = I.object_id AND SI.index_id = I.unique_index_id
ORDER BY C.name, S.name, O.name
-- FullText Indexed Column info
SELECT C.name CatalogName
, S.name FTItemSchema
, O.name FTItemName
-- , IC.object_id
, IC.language_id
, FIC.name IndexedColumnName
, FIT.name + '(' + CASE FIC.max_length WHEN -1 THEN 'max' ELSE CONVERT(NVARCHAR(20), FIC.max_length / (CASE WHEN FIT.name IN ('nchar', 'nvarchar') THEN 2 ELSE 1 END ) ) END + ')' IndexedColumnType
, FIC.is_nullable IndexedColumnNullable
, TIC.name TypeColumnName
, TIT.name + '(' + CASE TIC.max_length WHEN -1 THEN 'max' ELSE CONVERT(NVARCHAR(20), TIC.max_length / (CASE WHEN TIT.name IN ('nchar', 'nvarchar') THEN 2 ELSE 1 END ) ) END + ')' TypeColumnType
, TIC.is_nullable TypeColumnNullable
FROM sys.fulltext_index_columns IC
INNER JOIN sys.fulltext_indexes I ON I.object_id = IC.object_id
INNER JOIN sys.fulltext_catalogs C ON C.fulltext_catalog_id = I.fulltext_catalog_id
INNER JOIN sys.objects O ON O.object_id = IC.object_id
INNER JOIN sys.schemas S ON S.schema_id = O.schema_id
INNER JOIN sys.columns FIC ON FIC.object_id = IC.object_id AND FIC.column_id = IC.column_id
INNER JOIN sys.types FIT ON FIT.user_type_id = FIC.user_type_id
LEFT JOIN sys.columns TIC ON TIC.object_id = IC.object_id AND TIC.column_id = IC.type_column_id
LEFT JOIN sys.types TIT ON TIT.user_type_id = TIC.user_type_id
ORDER BY C.name, S.name, O.name, IC.column_id