an ASP.NET Open Source CMS & eCommerce platform
Search:
Skip Navigation LinksHome > DotShoppingCart Forums > Support > Using DotShoppingCart > Full Text Search not consistent?
Last Post 3/31/2010 3:03:21 AM By Applied. 5 replies.
3/26/2010 10:39:16 AM
Applied
Posts: 93
Joined: 9/18/2009
Full Text Search not consistent?
Is there an obvious reason why using the full text search box using (for example) 'CLIP ON BUTANE' does not return a result, whilst 'CLIP ON' or 'CLIP BUTANE' does??
 
Thanks.
 
3/26/2010 11:56:43 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Full Text Search not consistent?
Are you searching for products or articles? Have you tried moving the quotes?
DotShoppingCart Staff
3/28/2010 3:36:33 PM
Applied
Posts: 93
Joined: 9/18/2009
Re: Full Text Search not consistent?
I am searching for products. The descriptions are there. The quotes are not part of the text, I just used those to emphasise what I was looking for. I have rebuilt the SQL Server full text indexes.
3/30/2010 8:27:12 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Full Text Search not consistent?
Could you please provide the link to your site and product?
DotShoppingCart Staff
3/30/2010 5:07:58 PM
4safety
Posts: 124
Joined: 5/11/2009
Re: Full Text Search not consistent?
I am finding the same issues now since dashes are enabled when searching for a product as
 
75-1305 finds the product but 751305 does not
3/31/2010 3:03:21 AM
Applied
Posts: 93
Joined: 9/18/2009
Re: Full Text Search not consistent?
The full-text search as used in the stored procedure DSC_Product_Search looks for ALL matching words (via the CONTAINS keyword).
 
If the search text contains 'noise words' (also known as stop-words) such as 'ON' then this causes an error in SQL and it seems no results are returned.
 
You could amend the SP from:
 
WHERE CONTAINS(p.*,' + QUOTENAME('FORMSOF(INFLECTIONAL,' + QUOTENAME(dbo.DSC_Escape(dbo.DSC_Escape(Value, N'\'), N';'), '"') + ')', '''') +  ')
 
to:
 
WHERE FREETEXT(p.*,' + QUOTENAME('FORMSOF(INFLECTIONAL,' + QUOTENAME(dbo.DSC_Escape(dbo.DSC_Escape(Value, N'\'), N';'), '"') + ')', '''') +  ')

but this will return all matching items where ANY of the words match.
 
You can also amend the SP to not use FORMSOF(INFLECTIONAL... (note that INFLECTIONAL finds all of the tenses of a word) and instead use "AND" or "NEAR" keywords to look for matches:
 
Example:
 
CONTAINS(p.*,'clip AND on AND butane AND regulator')
 
NOTE THAT THE 'SEARCH' METHOD IN PRODUCT.CS may be amended so that it does not pass keywords to the SP as comma-delimited. We have amended it to pass space-delimited keywords which our (amended) SP changes to use the 'near' keyword (or its '' shortcut representation). That seems to then return what we are looking for.
 
LATEST
 
If you are using SQL 2008 and you ensure that 'compatability mode' is set to 2008, you can issue a TSQL command to turn OFF stop-word checking, e.g.
 
ALTER FULLTEXT INDEX ON [DSC_PRODUCT] SET STOPLIST OFF
 
and this will also then allow results to come back where previously they would not.
 
Turn it back on again using e.g. ALTER FULLTEXT INDEX ON [DSC_PRODUCT] SET STOPLIST SYSTEM