sql - CONTAINSTABLE issue -
i have set full-text indexing in database along containstable
users can search on website against product skus & product names. have set customization on search, strips hyphen (-) out of users search , in database column when grabs values. have run issue on search searching '10-10' results in broken page, error listing :
source:.net sqlclient data provider message:timeout expired. timeout period elapsed prior completion of operation or server not responding. stack trace: @ system.data.sqlclient.sqlconnection.onerror(sqlexception exception, boolean breakconnection) @ system.data.sqlclient.tdsparser.throwexceptionandwarning(tdsparserstateobject stateobj) @ system.data.sqlclient.tdsparser.run(runbehavior runbehavior, sqlcommand cmdhandler, sqldatareader datastream, bulkcopysimpleresultset bulkcopyhandler, tdsparserstateobject stateobj) @ system.data.sqlclient.sqldatareader.consumemetadata() @ system.data.sqlclient.sqldatareader.get_metadata() @ system.data.sqlclient.sqlcommand.finishexecutereader(sqldatareader ds, runbehavior runbehavior, string resetoptionsstring) @ system.data.sqlclient.sqlcommand.runexecutereadertds(commandbehavior cmdbehavior, runbehavior runbehavior, boolean returnstream, boolean async) @ system.data.sqlclient.sqlcommand.runexecutereader(commandbehavior cmdbehavior, runbehavior runbehavior, boolean returnstream, string method, dbasyncresult result) @ system.data.sqlclient.sqlcommand.runexecutereader(commandbehavior cmdbehavior, runbehavior runbehavior, boolean returnstream, string method) @ system.data.sqlclient.sqlcommand.executereader(commandbehavior behavior, string method) @ system.data.sqlclient.sqlcommand.executereader(commandbehavior behavior)
the search works great otherwise, , know hypen shouldn't issue, because if search 'tw5-c' few results returned. possible many results being returned , connection timing-out?
here sql containstable statement:
insert @searchfilter (productid, variantid, searchrank) select p.productid, pv.variantid, 100 dbo.product p with(nolock) join dbo.productvariant pv with(nolock) on p.productid = pv.productid join dbo.productstore ps with(nolock) on p.productid = ps.productid , ps.storeid = @storeid ( replace(p.sku,'-','') '%' + @searchstr + '%' ) or ( replace(p.name,'-','') '%' + @searchstr + '%' ) union select p.productid, pv.variantid, case when psearch.[key] not null psearch.rank when pvsearch.[key] not null pvsearch.rank else 1 end searchrank dbo.product p with(nolock) join dbo.productvariant pv with(nolock) on p.productid = pv.productid -- fulltext indexing changes more accurate searches join containstable(product, *, @ftssearchstring) psearch on p.productid = psearch.[key] left join containstable(productvariant, *, @ftssearchstring) pvsearch on pv.variantid = pvsearch.[key]
Comments
Post a Comment