Okay,
I believe I am missing something crucial to fulltext searching. We are
looking at ways to change a search from using "like" to "contains" in
hopes of improving search performance on a table. We have a fulltext
index on a lastname column.
The current search is something like this:
Declare @lastname varchar(50)
SET @lastname = 'b'
SELECT * FROM tablename WHERE lastname like '%' + @lastname + '%'
The above query returns all the records (over 50,000) correctly.
My question is, can fulltext searching return all records in a column
where 'b' is anywhere to be found in that column? I'm asking because
when I use contains or freetext, the query only returns items where
lastname begins or ends with 'b' (Even using the * wildcard).
Declare @lastname varchar(50)
SET @lastname = 'b'
SELECT * FROM tablename WHERE contains(lastname , @lastname)
Above gives 14 rows
SELECT * FROM tablename WHERE contains(lastname , '" *b* "')
Above gives 14 rows.
Any help as to whether or not I'm spinning my wheels on something that
cannot be done, would be greatly appreciated.
Thanks,
Amy Marshall
Hilary Cotter - 20 Jul 2006 19:27 GMT
No, it can't. The wildcard operator allows you to do prefix searches where
the beginning of a word or token starts with the letter b, but you can't do
full-text searches where the letter is in the middle or the end of the word.

Signature
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
> Okay,
>
[quoted text clipped - 34 lines]
>
> Amy Marshall
amarshall@newportgroup.com - 20 Jul 2006 19:56 GMT
Hilary,
Thanks. I will stop spinning my wheels.
Amy
> No, it can't. The wildcard operator allows you to do prefix searches where
> the beginning of a word or token starts with the letter b, but you can't do
[quoted text clipped - 52 lines]
> >
> > Amy Marshall