FIX: Full-Text Search Support for TOP via CONTAINSTABLE and FREETEXTTABLE Clauses

ID: Q240833


The information in this article applies to:
  • Microsoft SQL Server, Standard Edition, version 7.0
  • Microsoft SQL Server, Enterprise Edition, version 7.0

BUG #: 56082 (SQLBUG_70)

SYMPTOMS

Customers who have large Full-Text-enabled tables (usually, greater than 1 million rows) and have a need to restrict the results to the TOP number or percentage of rows returned can use a new syntax, Top_N_Rank, that has been included with CONTAINSTABLE and FREETEXTTABLE Full-Text Search query predicates. Also, Full-Text Search query performance is improved (as measured as number of rows returned per second) using this new syntax.

SQL Server 7.0 service packs later than Service Pack 1 will have the syntax for CONTAINSTABLE and FREETEXTTABLE extended as shown below:


   CONTAINSTABLE (table, {column | *}, 'contains_search_condition',{top_n_rank})

   FREETEXTTABLE (table, {column | *}, 'freetext_string',{top_n_rank}) 
where top_n_rank is an integer indicating that the "Top N by Rank" rows that meet the contains-string are to be returned.

It is the application's responsibility to determine what value of N is to be used. For example, for a query with a non-full-text predicate:

SELECT TOP 200 T.* FROM TableWithFTColumn as T,   CONTAINSTABLE(TableWIthFTColumn,*,'test',300) as CT
   WHERE  T.key=CT.key  AND T.a > 5
   ORDER BY CT.rank 
It is up to the application to determine how many rows to request from CONTAINSTABLE. If too few are requested, the T.a > 5 predicate may filter out so many that fewer than 200 rows are returned even though there would be more matches if a higher Top-N-Rank value were used.


RESOLUTION

A supported fix that corrects this problem is now available from Microsoft, but it has not been fully regression tested and should be applied only to systems experiencing this specific problem. If you are not severely affected by this specific problem, Microsoft recommends that you wait for the next SQL Server service pack that contains this fix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information on support costs, please go to the following address on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp
The English version of this fix should have the following file attributes or later:

   Date      Time   Version      Size   File name   Platform
   ---------------------------------------------------------

                    7.00.718            s70718i.exe  i386
                    7.00.718            s70718a.exe  alpha 
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the above files may also contain additional files.


STATUS

Microsoft has confirmed this to be a problem in SQL Server version 7.0.


MORE INFORMATION

It is recommended that you include only one table per Full-Text Catalog when this parameter is used because this new Top_N_Rank functions on a per Catalog basis.

Additional query words:

Keywords : SSrvTran_SQL kbSQL kbbug7.00
Version : winnt:7.0
Platform : winnt
Issue type : kbbug


Last Reviewed: December 14, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.