an ASP.NET Open Source CMS & eCommerce platform
Search:
Skip Navigation LinksHome > DotShoppingCart Forums > Support > Using DotShoppingCart > Search Problem and bug - It fails when searchin...
Last Post 8/23/2010 12:37:35 PM By Bahram. 25 replies.
Page 2 of 3 (26 posts) << First < Prev 1 2 3 Next > Last >> 
8/18/2010 10:23:07 AM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: Search Problem and bug - It fails when searching phrases containing one numeric character
That comes to the concept of exact matching, How can we have Exact matches separated from individual word search.
 
8/18/2010 10:32:09 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Search Problem and bug - It fails when searching phrases containing one numeric character
"Product Search" is the exact match while "Html Search" is rank based search. Which one are you talking about?
DotShoppingCart Staff
8/18/2010 10:37:06 AM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: Search Problem and bug - It fails when searching phrases containing one numeric character
I am talking about Product search and it is not exact search, you can test "smartreader 7" on our site. it returns all product entries of smartreader and 7
8/18/2010 11:16:43 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Search Problem and bug - It fails when searching phrases containing one numeric character
I don't see the problem from our out of box software. You can use SQL profile to debug how store proc DSC_Product_Search is called.
DotShoppingCart Staff
8/18/2010 1:31:42 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: Search Problem and bug - It fails when searching phrases containing one numeric character
Where is your outof thebox product. Our site is V4.03 in source and database. no sp for search is customized or touched, it is the same.
8/18/2010 2:07:17 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: Search Problem and bug - It fails when searching phrases containing one numeric character
 I did not touched stopwords list, so does 7 in  'smartreader 7' is filtered by search so it seems I am looking for 'smartreader' only?
 
 
8/19/2010 10:41:41 AM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: Search Problem and bug - It fails when searching phrases containing one numeric character
 I executed the SP and extracted the Product search Query, the result for 'smartreader 7' was not exact, but for 'smartreader 6W' it was. My question is does the stoplists (0-9) apply to the exact search scenarios or not?
 
8/19/2010 11:23:59 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Search Problem and bug - It fails when searching phrases containing one numeric character
The product search query doesn't use stoplists and it's doing exact search. Would you please post the SQL script to call the sproc?
DotShoppingCart Staff
8/19/2010 12:17:58 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: Search Problem and bug - It fails when searching phrases containing one numeric character
I have called the SP direcrly :
 
Declare @A as int
exec dbo.DSC_Product_Search null,'smartreader 7' , 24,1 ,'productName',1,null, @A
 
And also by SP scripts  :

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

 DECLARE @categoryId INT
 DECLARE @keywords NVARCHAR (MAX)
 DECLARE @ProductsPerPage INT
 DECLARE @rowIndex INT=0
 DECLARE @OrderBy NVARCHAR (100)
 DECLARE @ASC BIT=1
 DECLARE @showOutofStock BIT
 DECLARE @TotalProducts INT

 --SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

DECLARE @KeywordMatchedProducts NVARCHAR(MAX)

 SET @KeywordMatchedProducts = ''
 SET @keywords = 'smartreader 7'
 SET @ProductsPerPage = 24
 SET @OrderBy = 'productName'
 SET @categoryId =NULL
 SET  @showOutofStock =NULL
 IF ((@keywords IS NOT NULL) AND (LEN(@keywords) > 0))
  BEGIN
   SELECT @KeywordMatchedProducts = @KeywordMatchedProducts + '
    (SELECT  p.ProductId
    FROM products productsToCheck
    JOIN dbo.DSC_Product p
      ON productsToCheck.productId = p.productId
    WHERE   CONTAINS(p.*,' + QUOTENAME('FORMSOF(INFLECTIONAL,' + QUOTENAME(dbo.DSC_Escape(dbo.DSC_Escape(Value, N'\'), N';'), '"') + ')', '''') +  ')
    UNION
    SELECT  p.productId
    FROM products p
    JOIN DSC_Product_Descriptor pd
      ON pd.productId = p.productId
    WHERE CONTAINS(pd.*,' + QUOTENAME('FORMSOF(INFLECTIONAL,' + QUOTENAME(dbo.DSC_Escape(dbo.DSC_Escape(Value, N'\'), N';'), '"') + ')', '''') +  ')
    UNION
    SELECT  p.productId
    FROM products p
    JOIN DSC_Product_Attribute_Map pa
      ON pa.productId = p.productId
    JOIN DSC_Attribute a
      ON a.attributeId = pa.attributeId
    WHERE CONTAINS(a.*,' + QUOTENAME('FORMSOF(INFLECTIONAL,' + QUOTENAME(dbo.DSC_Escape(dbo.DSC_Escape(Value, N'\'), N';'), '"') + ')', '''') +  ')
    UNION
    SELECT  p.productId
    FROM products p
    JOIN DSC_Product_Attribute_Map pa
      ON pa.productId = p.productId
    JOIN DSC_Product_Attribute_Value pav
      ON pav.productAttributeId = pa.productAttributeId
    WHERE CONTAINS(pav.*,' + QUOTENAME('FORMSOF(INFLECTIONAL,' + QUOTENAME(dbo.DSC_Escape(dbo.DSC_Escape(Value, N'\'), N';'), '"') + ')', '''') +  ')
    UNION
    SELECT  p.productId
    FROM products p
    JOIN dbo.DSC_Manufacturer m
      ON m.manufacturerId = p.manufacturerId
    WHERE CONTAINS(m.*,' + QUOTENAME('FORMSOF(INFLECTIONAL,' + QUOTENAME(dbo.DSC_Escape(dbo.DSC_Escape(Value, N'\'), N';'), '"') + ')', '''') +  '))
    INTERSECT'
   FROM DSC_Parse_Values(@keywords, DEFAULT)
   SET  @KeywordMatchedProducts = LEFT(@KeywordMatchedProducts, LEN(@KeywordMatchedProducts) - 9) -- remove tailing INTERSECT
  END
 ELSE
  SET @KeywordMatchedProducts = 'SELECT productId FROM products'
 
 DECLARE @ASC_DESC NVARCHAR(10)
 IF (@ASC = 1)
  SET @ASC_DESC = ''
 ELSE
  SET @ASC_DESC = ' DESC'

 CREATE TABLE #product (RowNumber INT, productId INT)

 DECLARE @searchStatement NVARCHAR(MAX)
 SET  @searchStatement = '
 ;WITH  products AS
 (
  SELECT p.productId, p.manufacturerId
  FROM dbo.DSC_Product p '

 IF (@categoryId IS NOT NULL)
 BEGIN
  SET @searchStatement = @searchStatement +
  'JOIN DSC_Category_Product_Map cpmap
    ON cpmap.productId = p.productId
  JOIN DSC_Category_GetChildren(' + CAST(@categoryId AS VARCHAR(20)) + ') c
    ON c.categoryId = cpmap.categoryId '
 END

 SET @searchStatement = @searchStatement +
 '),
 keywordMatchedProducts AS
 (' + @KeywordMatchedProducts + '
 ),
 matchedProducts AS
 (
  SELECT DISTINCT productId
  FROM keywordMatchedProducts
 )
 INSERT INTO #product
 SELECT ROW_NUMBER() OVER (ORDER BY ' + QUOTENAME(@OrderBy) + @ASC_DESC + ') AS RowNumber, mp.productId
 FROM matchedProducts mp
 JOIN DSC_Product p
   ON p.productId = mp.productId
 JOIN vw_DSC_Product_Stock ps
   ON ps.productId = p.productId
 WHERE ((@showOutofStock IS NULL) OR (((ps.InStock = 1) OR (p.showIfOutofStock = 1) OR ((p.showIfOutofStock IS NULL) AND (@showOutofStock = 1))) AND (p.statusId < 200)))'

 PRINT @searchStatement
 EXECUTE sp_executesql @searchStatement, N'@showOutofStock BIT', @showOutofStock
/*
 SELECT @TotalProducts = COUNT(*)
 FROM #product
*/
 SELECT products.RowNumber, products.productId
 INTO #subset_Product
 FROM #product products
 WHERE products.RowNumber BETWEEN @rowIndex + 1 AND @rowIndex + @ProductsPerPage
 ORDER BY products.RowNumber
 
 DROP TABLE #product
 
 SELECT products.*, p.* -- need to sort by RowNumber if the column exist
 FROM #subset_Product products
 JOIN DSC_Product p
   ON products.productId = p.productId
 ORDER BY 1 
 --EXEC DSC_Product_GetSummaryByTempTable
    DROP TABLE #subset_Product
 

 
<font color="#0000ff" size="2"><font color="#0000ff" size="2">
In both case the same result not exact match for 'smartreader 7'
8/19/2010 3:08:56 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: Search Problem and bug - It fails when searching phrases containing one numeric character
Luke,
 
The SP  Query : DSC_Product_Search<font color="#0000ff" size="2"><font color="#0000ff" size="2"> does not works correct in a multi token phrase when of the tokens is one digit 
 
that means :
'smartreader plus 10' works and returns 1 row
while
'smartreader plus 1' returns any row of smartreader plus and 1
 
I hope it help to debug and fix the SP
 
Thanks,
Page 2 of 3 (26 posts) << First < Prev 1 2 3 Next > Last >>