安装和配置语义搜索Install and Configure 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 prerequisites for statistical semantic search and how to install or check them.

检查是否安装了语义搜索Check whether Semantic Search is installed

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

返回值 1 表示安装了全文搜索和语义搜索;返回值 0 表示未安装它们。A return value of 1 indicates that Full-Text Search and Semantic Search are installed; a return value of 0 indicates that they are not installed.

SELECT SERVERPROPERTY('IsFullTextInstalled');  
GO  

安装语义搜索Install Semantic Search

若要安装语义搜索,在 SQL Server 安装过程中,请在“要安装的功能”页上选择“全文和语义提取搜索”。 To install Semantic Search, select Full-Text and Semantic Extractions for Search on the Features to Install page during SQL Server setup.

统计语义搜索依赖于全文搜索。Statistical Semantic Search depends on Full-Text Search. SQL ServerSQL Server 的这两个可选功能是一起安装的。These two optional features of SQL ServerSQL Server are installed together.

安装语义语言统计数据库Install the Semantic Language Statistics Database

语义搜索具有一个称为语义语言统计数据库的附加外部依赖项。Semantic Search has an additional external dependency that is called the semantic language statistics database. 此数据库包含语义搜索所需的统计语言模型。This database contains the statistical language models required by semantic search. 单个语义语言统计数据库包含语义索引支持的所有语言的语言模型。A single semantic language statistics database contains the language models for all the languages that are supported for semantic indexing.

检查是否安装了语义语言统计数据库Check whether the Semantic Language Statistics Database is installed

查询目录视图 sys.fulltext_semantic_language_statistics_database (Transact-SQL)Query the catalog view sys.fulltext_semantic_language_statistics_database (Transact-SQL).

如果为该实例安装并注册了语义语言统计数据库,则查询结果将包含有关该数据库的单行信息。If the semantic language statistics database is installed and registered for the instance, then the query results contain a single row of information about the database.

SELECT * FROM sys.fulltext_semantic_language_statistics_database;  
GO  

安装、附加和注册语义语言统计数据库Install, attach, and register the Semantic Language Statistics Database

SQL ServerSQL Server 安装程序不安装语义语言统计数据库。The semantic language statistics database is not installed by the SQL ServerSQL Server setup program. 若要将语义语言统计数据库设置为语义索引的必备组件,请执行以下操作:To set up the Semantic Language Statistics database as a prerequisite for semantic indexing, do the following things:

1.安装语义语言统计数据库。1. Install the semantic language statistics database.

  1. SQL ServerSQL Server 安装介质上找到语义语言统计数据库,或者从 Web 上下载它。Locate the semantic language statistics database on the SQL ServerSQL Server installation media or download it from the Web.

    1. 安装介质上找到名为 SemanticLanguageDatabase.msi SQL ServerSQL Server 的 Windows 安装程序包。Locate the Windows installer package named SemanticLanguageDatabase.msi on the SQL ServerSQL Server installation media.

    2. MicrosoftMicrosoft下载中心的 Microsoft® SQL Server® 2016 语义语言统计页上下载安装程序包。Download the installer package from the Microsoft® SQL Server® 2016 Semantic Language Statistics page on the MicrosoftMicrosoft Download Center.

  2. 运行 SemanticLanguageDatabase.msi Windows 安装程序包,以提取数据库和日志文件。Run the SemanticLanguageDatabase.msi Windows installer package to extract the database and log file.

    也可以选择更改目标目录。You can optionally change the destination directory. 默认情况下,安装程序将文件提取到 Program Files 文件夹中名为 Microsoft Semantic Language Database 的文件夹。By default, the installer extracts the files to a folder named Microsoft Semantic Language Database in the Program Files folder. MSI 文件包含压缩的数据库文件和日志文件。The MSI file contains a compressed database file and log file.

  3. 将提取的数据库文件和日志文件移到文件系统中的合适位置。Move the extracted database file and log file to a suitable location in the file system.

    如果将文件放入默认位置,则不可能为另一个 SQL ServerSQL Server实例提取数据库的另一个副本。If you leave the files in their default location, it will not be possible to extract another copy of the database for another instance of SQL ServerSQL Server.

    重要

    提取语义语言统计数据库时,向文件系统默认位置中的数据库文件和日志文件分配受限权限。When the semantic language statistics database is extracted, restricted permissions are assigned to the database file and log file in the default location in the file system. 因此,如果将文件放入默认位置,您可能没有附加该数据库的权限。As a result, you may not have permission to attach the database if you leave it in the default location. 如果在尝试附加数据库时引发了错误,请删除这些文件,或检查并根据需要修复文件系统权限。If an error is raised when you try to attach the database, move the files, or check and fix file system permissions as appropriate.

2.附加语义语言统计数据库。2. Attach the semantic language statistics database.

使用 Management StudioManagement Studio 或通过 FOR ATTACH 语法调用 CREATE DATABASE (SQL Server Transact-SQL) 将数据库附加到 SQL ServerSQL Server 实例。Attach the database to the instance of SQL ServerSQL Server by using Management StudioManagement Studio or by calling CREATE DATABASE (SQL Server Transact-SQL) with the FOR ATTACH syntax. 有关详细信息,请参阅数据库分离和附加 (SQL Server)For more information, see Database Detach and Attach (SQL Server).

默认情况下,该数据库的名称为 semanticsdbBy default, the name of the database is semanticsdb. 也可以选择在附加数据库时为数据库提供其他名称。You can optionally give the database a different name when you attach it. 当使用后续步骤注册数据库时,必须提供此名称。You have to provide this name when you register the database in the subsequent step.

CREATE DATABASE semanticsdb  
            ON ( FILENAME = 'C:\Microsoft Semantic Language Database\semanticsdb.mdf' )  
            LOG ON ( FILENAME = 'C:\Microsoft Semantic Language Database\semanticsdb_log.ldf' )  
            FOR ATTACH;  
GO  

此代码示例假定您将数据库从其默认位置移动到新位置。This code sample assumes that you have moved the database from its default location to a new location.

3.注册语义语言统计数据库。3. Register the semantic language statistics database.

调用 sp_fulltext_semantic_register_language_statistics_db (Transact-SQL) 存储过程,并提供在附加数据库时向该数据库提供的名称。Call the stored procedure sp_fulltext_semantic_register_language_statistics_db (Transact-SQL) and provide the name that you gave to the database when you attached it.

EXEC sp_fulltext_semantic_register_language_statistics_db @dbname = N'semanticsdb';  
GO  

语义语言统计数据库的要求和限制Requirements and restrictions for the Semantic Language Statistics Database

  • 在一个 SQL ServerSQL Server实例上只能附加和注册一个语义语言统计数据库。You can only attach and register one semantic language statistics database on an instance of SQL ServerSQL Server.

    单个计算机上的每个 SQL ServerSQL Server 实例都需要一个单独的语义语言统计数据库的物理副本。Each instance of SQL ServerSQL Server on a single computer requires a separate physical copy of the semantic language statistics database. 对每个实例附加一个副本。Attach one copy to each instance.

  • 您不能分离注册的有效语义语言统计数据库,并将其替换为一个任意同名的数据库。You cannot detach a valid and registered semantic language statistics database and replace it with an arbitrary database that has the same name. 这样做将导致当前或未来的索引填充失败。Doing so will cause active or future index populations to fail.

  • 语义语言统计数据库是只读的。The semantic language statistics database is read-only. 您不能自定义此数据库。You cannot customize this database. 如果您以任何方式更改数据库的内容,未来语义索引的结果将是不确定的。If you alter the content of the database in any way, the results for future semantic indexing are indeterministic. 若要恢复此数据的原始状态,您可以删除已更改的数据库,然后下载并附加未更改的数据库新副本。To restore the original state of this data, you can drop the altered database, and download and attach a new and unaltered copy of the database.

  • 可以分离或删除语义语言统计数据库。It is possible to detach or drop the semantic language statistics database. 如果存在任何对数据库具有读锁定的当前索引操作,则分离或删除操作将失败或超时。这与现有行为一致。If there are any active indexing operations that have read locks on the database, then the detach or drop operation will fail or time out. This is consistent with existing behavior. 删除该数据库后,任何语义索引操作都将失败。After the database is removed, semantic indexing operations will fail.

删除语义语言统计数据库Remove the Semantic Language Statistics Database

取消注册、分离和删除语义语言统计数据库Unregister, detach, and remove the Semantic Language Statistics Database

1.取消注册语义语言统计数据库。1. Unregister the semantic language statistics database.

调用 sp_fulltext_semantic_unregister_language_statistics_db (Transact-SQL) 存储过程。Call the stored procedure sp_fulltext_semantic_unregister_language_statistics_db (Transact-SQL). 由于一个实例仅有一个语义语言统计数据库,因此您不必提供该数据库的名称。You do not have to provide the name of the database since an instance can have only one semantic language statistics database.

EXEC sp_fulltext_semantic_unregister_language_statistics_db;  
GO  

2.分离语义语言统计数据库。2. Detach the semantic language statistics database.

调用 sp_detach_db (Transact-SQL) 存储过程并提供该数据库的名称。Call the stored procedure sp_detach_db (Transact-SQL) and provide the name of the database.

USE master;  
GO  
  
EXEC sp_detach_db @dbname = N'semanticsdb';  
GO  

3.删除语义语言统计数据库。3. Remove the semantic language statistics database.

撤消注册并分离该数据库后,您可以删除数据库文件。After unregistering and detaching the database, you can simply delete the database file. 不提供卸载程序,在“控制面板”的 “程序和功能” 中没有相应条目。There is no uninstall program and there is no entry in Programs and Features in the Control Panel.

安装对较新文档类型的可选支持Install optional support for newer document types

为 Microsoft Office 和其他 Microsoft 文档类型安装最新筛选器Install the latest filters for Microsoft Office and other Microsoft document types

SQL ServerSQL Server 安装最新的 MicrosoftMicrosoft 断字符和词干分析器,但是不为 MicrosoftMicrosoft Office 文档和其他 MicrosoftMicrosoft 文档类型安装最新的筛选器。installs the latest MicrosoftMicrosoft word breakers and stemmers, but does not install the latest filters for MicrosoftMicrosoft Office documents and other MicrosoftMicrosoft document types. 要为使用最新版本的 MicrosoftMicrosoft Office 和其他 MicrosoftMicrosoft 应用程序创建的文档编制索引,必须安装这些筛选器。These filters are required for indexing documents created with recent versions of MicrosoftMicrosoft Office and other MicrosoftMicrosoft applications. 若要下载最新的筛选器,请参阅 Microsoft Office 2010 Filter PacksTo download the latest filters, see Microsoft Office 2010 Filter Packs. (对于 Office 2013 或 Office 2016,不会显示为筛选器包版本。)(There does not appear to be a Filter Pack release for Office 2013 or Office 2016.)