PRB: Dashes '-' Ignored in Search with SQL Full-Text and MSIDXS Queries

ID: Q200043


The information in this article applies to:
  • Microsoft SQL Server version 7.0
  • Microsoft OLE DB Provider for Index Server, version 2.0


SYMPTOMS

When performing a full-text search on SQL Server character data, or when using a SQL distributed query with the Microsoft Index Server OLE DB provider (MSDIXS) and a prefix expansion search for a compound word that contains a hyphen (for example, "XYZ-A*"), the results produced may not be as expected.


CAUSE

A full-text search considers a word to be a string of characters without spaces or punctuation. The occurrence of a non-alphanumeric character can "break" a word during a search. Because the SQL Server full-text search is a word-based engine, punctuation generally is not considered and is ignored when searching the index. Therefore, a CONTAINS clause like 'CONTAINS(testing, "computer failure")' would match a row with the value, "The failure to find my computer would be expensive.".

WORKAROUND

To work around this problem, try the following:
  • Only use alphanumeric characters when using the SQL Server 7.0 full-text index facilities.

    -or-


  • Where non-alphanumeric character must be used in the search critera (primarily the dash '-' character), use the Transact-SQL LIKE clause instead of the FULLTEXT or CONTAINS predicates.



STATUS

This behavior is by design.


MORE INFORMATION

Microsoft SQL Server version 7.0 provides the ability to perform a full-text query on character data stored in SQL Server tables. You can also use a SQL distributed query with the MSDIXS provider to search for file system data. Using the dash ('-') in a proximity search is not supported and may give unexpected results.


REFERENCES

For more details on SQL Server 7.0 full-text search, refer to the SQL Server 7.0 Books Online.

For more information on the use of the CONTAINS clause with the Microsoft Index Server (MSDIXS) provider, refer to the Index Server documentation in the Windows NT 4.0 Option Pack documentation.

For further information on how full-text search and the LIKE clause are implemented in SQL Server 7.0, see the following white papers and Microsoft Knowledge Base article:

Q182829 DOCERR: Prefix Expansion with Index Server OLEDB Provider 2.0
Textual Searches on Database Data Using Microsoft SQL Server 7.0
http://www.microsoft.com/sql/70/whpprs/textsearch.htm

Microsoft SQL Server 7.0 Query Processor
http://www.microsoft.com/sql/70/whpprs/qp.htm

Microsoft SQL Server 7.0 Performance Tuning Guide
http://msdn.microsoft.com/developer/sqlserver/sql7perftune.htm

Additional query words: kbDSupport oledb filesystem alpha numeric alpha-numeric

Keywords : kbDatabase kbOLEDB kbSQLServ kbVC
Version : WINDOWS:2.0; winnt:7.0
Platform : WINDOWS winnt
Issue type : kbprb


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