Link to home
Start Free TrialLog in
Avatar of gogetsome
gogetsomeFlag for United States of America

asked on

Full-Text Contains help needed

Hello, I need to find the best possible search method for a products table that has 4 columns indexed. This will be used on website where customers are searching for products.

When using

declare @SearchString varchar(1000) set @SearchString = '"word" and "of" and "promise"'
select productid, title
from productsearch
where CONTAINS((Contributor, PrimItemNumber, SecItemNumber, Title), @SearchString)

I get only these products:
173066      Every Promise Of Your Word : With Standing On The Promises
211181      Every Promise Of Your Word
211181      Every Promise Of Your Word
284043      Word of Promise Soundtrack    
293693      Word of Promise Next Generation New Testament (20 CDs)  
296904      Word of Promise Inspiration for Today (Vol. 1)

Not exactly a good pull.

I was expecting more along these lines:

Word of Promise - Complete Audio Bible (79 CDs)
Word of Promise - Complete Audio Bible (Download)
Word of Promise - Complete Audio Bible (MP3 Discs)
Word of Promise - New Testament Audio Bible (20 CDs)
Word of Promise Gift of Psalms
Word of Promise Inspiration for Today (Vol. 1)
Word of Promise Next Generation New Testament (MP3 Discs)
Word of Promise Next Generation New Testament (20 CDs)
Word of Promise Easter Story

Because of the "of" in the title I removed "of" from the stoplist. If not I get no results.

Why does the search perform so poorly? What is the best method to allow customers to search for products when they can type in either: author, isbn or title and half the time only know partial information of a title or authors name?

Any help is greatly appreciated!
Avatar of Brian Crowe
Brian Crowe
Flag of United States of America image

Have you considered moving all of the searchable values into a separate table?  Something like:

CREATE TABLE ProductString
(
   ProductStringID INT IDENTITY(1,1),
   ProductID INT NOT NULL,
   StringTypeID INT NOT NULL,  --FK to type table containing Author, Title, ISBN, etc.
   String NVARCHAR(4000) NOT NULL
)

Obviously this could be fleshed out a little more but the general idea is to get all of the string in a single index.  I don't know that this would solve your search issues above but I would expect it to perform better and it would make localization easier down the road as you could just add a language field.

Just an idea
ASKER CERTIFIED SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gogetsome

ASKER

Awe I see if I encapsulate with " " it works that way with contains as well.