管理和监视语义搜索Manage and Monitor Semantic Search

适用对象:是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

说明语义索引编制过程以及与管理和监视索引相关的任务。Describes the process of semantic indexing and the tasks related to managing and monitoring the indexes.

检查语义索引编制的状态Check the status of semantic indexing

语义索引编制的第一阶段是否已完成?Is the first phase of semantic indexing complete?

查询动态管理视图 sys.dm_fts_index_population (Transact SQL),并检查 statusstatus_description 列。Query the dynamic management view, sys.dm_fts_index_population (Transact-SQL), and check the status and status_description columns.

索引编制的第一阶段包括填充全文关键字索引和语义关键短语索引,以及提取文档相似性数据。The first phase of indexing includes the population of the full-text keyword index and the semantic key phrase index, as well as the extraction of document similarity data.

USE database_name  
GO  
  
SELECT * FROM sys.dm_fts_index_population WHERE table_id = OBJECT_ID('table_name')  
GO  

语义索引编制的第二阶段是否已完成?Is the second phase of semantic indexing complete?

查询动态管理视图 sys.dm_fts_semantic_similarity_population (Transact SQL),并检查 statusstatus_description 列。Query the dynamic management view, sys.dm_fts_semantic_similarity_population (Transact-SQL), and check the status and status_description columns..

索引编制的第二阶段包括填充语义文档相似性索引。The second phase of indexing includes the population of the semantic document similarity index.

USE database_name  
GO  
  
SELECT * FROM sys.dm_fts_semantic_similarity_population WHERE table_id = OBJECT_ID('table_name')  
GO  

检查语义索引的大小Check the size of the semantic indexes

语义关键短语索引或语义文档相似性索引的逻辑大小是多少?What is the logical size of a semantic key phrase index or a semantic document similarity index?

查询动态管理视图 sys.dm_db_fts_index_physical_stats (Transact SQL)Query the dynamic management view, sys.dm_db_fts_index_physical_stats (Transact-SQL).

以索引页数显示该逻辑大小。The logical size is displayed in number of index pages.

USE database_name  
GO  
  
SELECT * FROM sys.dm_db_fts_index_physical_stats WHERE object_id = OBJECT_ID('table_name')  
GO  

全文目录的全文索引和语义索引的总大小是多少?What is the total size of the full-text and semantic indexes for a full-text catalog?

查询 FULLTEXTCATALOGPROPERTY (Transact SQL) 元数据函数的 IndexSize 属性 。Query the IndexSize property of the FULLTEXTCATALOGPROPERTY (Transact-SQL) metadata function.

SELECT FULLTEXTCATALOGPROPERTY('catalog_name', 'IndexSize')  
GO  

有多少项编入全文目录的全文索引和语义索引?How many items are indexed in the full-text and semantic indexes for a full-text catalog?

查询 FULLTEXTCATALOGPROPERTY (Transact SQL) 元数据函数的 ItemCount 属性 。Query the ItemCount property of the FULLTEXTCATALOGPROPERTY (Transact-SQL) metadata function.

SELECT FULLTEXTCATALOGPROPERTY('catalog_name', 'ItemCount')  
GO  

强制填充语义索引Force the population of the semantic indexes

可以使用 START/STOP/PAUSE 或 RESUME POPULATION 子句以及针对全文索引而描述的相同语法和行为,强制填充全文索引和语义索引。You can force the population of full-text and semantic indexes by using the START/STOP/PAUSE or RESUME POPULATION clause with the same syntax and behavior that is described for full-text indexes. 更多详细信息,请参阅 ALTER FULLTEXT INDEX (Transact-SQL )填充全文索引For more information, see ALTER FULLTEXT INDEX (Transact-SQL) and Populate Full-Text Indexes.

由于语义索引编制依赖于全文索引编制,因此仅在填充关联的全文索引后填充语义索引。Since semantic indexing is dependent on full-text indexing, semantic indexes are only populated when the associated full-text indexes are populated.

示例:启动全文索引和语义索引的完全填充Example: Start a full population of full-text and semantic indexes

以下示例通过更改 AdventureWorks2012 示例数据库的 Production.Document 表的现有全文索引,启动全文索引和语义索引的完全填充。The following example starts full population of both full-text and semantic indexes by altering an existing full-text index on the Production.Document table in the AdventureWorks2012 sample database.

USE AdventureWorks2012  
GO  
  
ALTER FULLTEXT INDEX ON Production.Document  
    START FULL POPULATION  
GO  

禁用或重新启用语义索引编制Disable or re-enable semantic indexing

可以使用 ENABLE/DISABLE 子句以及针对全文索引而描述的相同语法和行为,启用或禁用全文索引编制或语义索引编制。You can enable or disable full-text or semantic indexing by using the ENABLE/DISABLE clause with the same syntax and behavior that is described for full-text indexes. 有关详细信息,请参阅 ALTER FULLTEXT INDEX (Transact-SQL )For more information, see ALTER FULLTEXT INDEX (Transact-SQL).

禁用和挂起语义索引编制时,可以继续成功进行针对语义数据的查询并返回以前的索引数据。When semantic indexing is disabled and suspended, queries over semantic data continue to work successfully and to return previously indexed data. 此行为与全文搜索的行为不一致。This behavior is not consistent with the behavior of Full-Text Search.

-- To disable semantic indexing on a table  
USE database_name  
GO  
  
ALTER FULLTEXT INDEX ON table_name DISABLE  
GO  
  
-- To re-enable semantic indexing on a table  
USE database_name  
GO  
  
ALTER FULLTEXT INDEX ON table_name ENABLE  
GO  

关于语义索引编制的阶段About the phases of semantic indexing

语义搜索对于启用它的每个列将两种类型的数据编入索引:Semantic Search indexes two kinds of data for each column on which it is enabled:

  1. 关键短语Key phrases

  2. 文档相似性Document similarity

语义索引编制在两个阶段中发生,与全文索引编制一起进行:Semantic indexing occurs in two phases, in conjunction with full-text indexing:

  1. 阶段 1Phase 1. 同时并行填充全文关键字索引和语义关键短语索引。The full-text keyword index and the semantic key phrase index are populated in parallel at the same time. 还在此时提取编制文档相似性索引所需的数据。The data required to index document similarity is also extracted at this time.

  2. 阶段 2Phase 2. 然后填充语义文档相似性索引。The semantic document similarity index is then populated. 此索引依赖于在前一阶段填充的两个索引。This index depends on both indexes that were populated in the preceding phase.

问题:未填充语义索引Issue: Semantic Indexes Are Not Populated

是否已填充关联的全文索引?Are the associated full-text indexes populated?

由于语义索引编制依赖于全文索引编制,因此仅在填充关联的全文索引后填充语义索引。Since semantic indexing is dependent on full-text indexing, semantic indexes are only populated when the associated full-text indexes are populated.

是否正确安装和配置了全文搜索和语义搜索?Are full-text search and semantic search properly installed and configured?

有关详细信息,请参阅 安装和配置语义搜索For more information, see Install and Configure Semantic Search.

FDHOST 服务是否不可用或存在导致全文索引编制失败的其他情况?Is the FDHOST service not available, or is there another condition that would cause full-text indexing to fail?

有关详细信息,请参阅 全文索引疑难解答For more information, see Troubleshoot Full-Text Indexing.