PRB: A Full-Text Search Query on TEXT or NTEXT Column Does Not Return Valid Results (241113)



The information in this article applies to:

  • Microsoft SQL Server 7.0

This article was previously published under Q241113

Notice

IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry

SYMPTOMS

When you run a full-text CONTAINS query on a full-text enabled text column that has more than 300 KB of text (more than 150 KB of UNICODE text for an ntext column ), you may receive a "0 rows affected" message even though valid results are present.

CAUSE

The Microsoft Search service (MSSearch.exe) maintains the full-text catalogs for SQL Server 7.0 full-text search to search character-based data types such as char, varchar, text and ntext. Columns that you define as text can have more than 300 KB of data (ntext can have more than 150 KB of UNICODE text). When the full-text index is populated, MSSearch service retrieves all the distinct words from the text column and stores them in the virtual memory before it merges them into the master index. The MSSearch property prevents the MSSearch service from consuming all the virtual memory. The MSSearch property is controlled by the following registry and its value: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Search\1.0\Indexer\SQLServer\ <Full_Text_Catalog_Name>\ MaxBytesPerFileFor example: Full_Text_Catalog_Name = SQL0000500005

The default value of this registry key is set to 307200 (300 KB). As a result, MSSearch service assumes 300 KB of text as significant and ignores the remaining data of the text column while it populates the full-text index.

Therefore, when you run a full-text CONTAINS clause query to search a word that is present in the text column after 300 KB of text, you may not obtain valid results.

WORKAROUND

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

To work around this problem:
  1. On the Start menu, click Run.
  2. Type regedit, and then click OK.
  3. Locate the following key in Registry Editor: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Search\1.0\Indexer\SQLServer\Full_Text_Catalog_Name\ (for example: Full_Text_Catalog_Name = SQL0000500005).
  4. Click the MaxBytesPerFile key of type REG_DWORD.
  5. On the Edit menu, click Modify, and then specify the Value Data of the registry key based on your requirement.
  6. Quit Registry Editor.
  7. Rebuild the full-text catalog.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior
  1. Add a unique word to the end of a text column. Use a word that has a text size greater than 300 KB in each row (for ntext, the text size is greater than 150 KB).
  2. Enable the column for full-text indexing.
  3. Populate the full-text catalog.
  4. Run the full-text CONTAINS clause query on the column to search the unique word that you added in step 1.

Modification Type:MinorLast Reviewed:4/22/2003
Keywords:kbRegistry kbprb KB241113 kbAudDeveloper