什么会阻止记录被添加到全文索引?

时间:2017-03-23 22:02:42

标签: sql-server sql-server-2008-r2 full-text-search

我遇到了一个问题,我从一个全文搜索中找不到任何结果,我知道那里有一条记录。删除索引并重新创建它修复了问题,这使我认为记录未添加到索引中。会导致什么?

这是在我们的QA环境中,我们偶尔会从生产备份中恢复此环境。这可能导致了这个吗? 编辑我刚刚在生产中运行了相同的查询,全文索引在那里返回了正确的结果,所以我不确定生产中的恢复是否会成为问题。

1 个答案:

答案 0 :(得分:1)

根据您的问题,我会说新增记录未添加的最可能原因是基于全文索引填充方式的配置。在SQL Server 2008 R2中,全文索引基于计划作业进行更新,而不是像其他索引那样动态插入/更新。要检查的问题:

另外,来自联机丛书的CREATE FULLTEXT INDEX (Transact-SQL)部分:

CHANGE_TRACKING [ = ] { MANUAL | AUTO | OFF [ , NO POPULATION ] }
Specifies whether changes (updates, deletes or inserts) made to table columns that are 
covered by the full-text index will be propagated by SQL Server to the full-text index. 
Data changes through WRITETEXT and UPDATETEXT are not reflected in the full-text index, 
and are not picked up with change tracking. 


MANUAL 
    Specifies that the tracked changes must be propagated manually by calling the 
    ALTER FULLTEXT INDEX … START UPDATE POPULATION Transact-SQL statement (manual 
    population). You can use SQL Server Agent to call this Transact-SQL statement 
    periodically. 

AUTO
    Specifies that the tracked changes will be propagated automatically as data is 
    modified in the base table (automatic population). Although changes are propagated 
    automatically, these changes might not be reflected immediately in the full-text 
    index. AUTO is the default. 

OFF [ , NO POPULATION] 
    Specifies that SQL Server does not keep a list of changes to the indexed data. When 
    NO POPULATION is not specified, SQL Server populates the index fully after it
    is created.

    The NO POPULATION option can be used only when CHANGE_TRACKING is OFF. When 
    NO POPULATION is specified, SQL Server does not populate an index after it is 
    created. The index is only populated after the user executes the 
    ALTER FULLTEXT INDEX command with the START FULL POPULATION or 
    START INCREMENTAL POPULATION clause.