Making a field non-searchable??
Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Customizing ProductCart
Forum Description: Exchange messages with other users that are customizing ProductCart.
URL: https://forum.productcart.com/forum_posts.asp?TID=1621
Printed Date: 21-November-2024 at 3:39pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Making a field non-searchable??
Posted By: njessen42
Subject: Making a field non-searchable??
Date Posted: 12-May-2008 at 6:27pm
Is there a way to make the [Details]/long description field non-searchable? We use this field for a lot of information and want to make sure customers aren't grabbing KW's out of it.
|
Replies:
Posted By: Hamish
Date Posted: 02-June-2008 at 3:51pm
Hi, I just re-read your post - I think I misunderstood it last time. Do you just wish to "hide" the long description field from the built in search facility? If so a mildly customized version of SearchResults.asp will be needed to drop that field. It won't stop Google etc from finding & indexing that text - or customers from copying the words etc though of course.
|
Posted By: njessen42
Date Posted: 02-June-2008 at 3:57pm
That is exactly what I want to do Hammish. Hide the long description from the built in search. We of course still want customers to still see it and google to index it. So the file to edit would be the SearchResults.asp. Thank you very much.
|
Posted By: Hamish
Date Posted: 02-June-2008 at 4:01pm
Yep - No problem - Look for code like : tmpSQL="(products.details LIKE " tmpSQL2="(products.description LIKE " tmpSQL3="(products.sDesc LIKE "
It occurs a few times & I don't recall off the top of my head which one you need to knock out - I would think it's products.description.
|
Posted By: Hamish
Date Posted: 02-June-2008 at 4:07pm
If your happy to do this yourself that's great - please post the definitive answer here - just in case others wish to do so.
Actually - I think the best line to comment out is a touch further down - strSQL=strSQL & " OR " & tmpSQL2
Line 475 in my copy. Or perhaps the line above that one. I'll have to look elsewhere to confirm which one. - Or you could just try it & see :-)
|
Posted By: njessen42
Date Posted: 02-June-2008 at 4:11pm
I think its the products.details. The field in my dbo.products table that I don't want searchable is details. This might help a ton, thanks a bunch.
Here is our site with over 18,000 products if you want to check it out, any suggestions would also be helpful. http://https://shop.rings-things.com/cart/pc/viewCategories.asp - http://https://shop.rings-things.com/cart/pc/viewCategories.asp
|
Posted By: njessen42
Date Posted: 02-June-2008 at 4:13pm
Well I am sure you guys can figure out what is wrong with the link above, how about this.
http://shop.rings-things.com/cart/pc/viewCategories.asp - http://shop.rings-things.com/cart/pc/viewCategories.asp
|
Posted By: Hamish
Date Posted: 02-June-2008 at 4:36pm
Darn it - Of course - The answer is in your question - It's the products.details - which IS the line above : It actuially appears TWICE - Lines 385 & 474.
|
Posted By: Hamish
Date Posted: 02-June-2008 at 4:55pm
18,000 products - Wow! It looks fine to me - although I know nowt about beads etc :-)
The only thing I noticed was the font color in the pop up tooltip still being the default blue - which you can change via the pc/ei-tooltip.css file.
BTW - The reason for suggesting the change above is that it's the least work & least change to the code - so easier to maintain. From a purist perspective it would be better to knock out more of the code, but I like, if at all possible to keep changes to the minimum for ease of maintenance unless there are significant reasons such as performance for making the the change greater in scope.
Was it you who posted on the performance of the searches before? I recall there being a site with a very large number of products who had some issue? This change will decrease the scope of the search so will naturally improve it's speed a bit.
|
Posted By: njessen42
Date Posted: 02-June-2008 at 5:04pm
Yes that was me that posted about the search performance. After we set up a ticket and got the new Patch from Early Impact the search speed increased dramatically.
Thanks for both tips now. I will for sure post if commenting out the above helps with removing the details search.
|
Posted By: Hamish
Date Posted: 02-June-2008 at 5:20pm
Hi, Did you get a new version of SearchResults.asp as part of the patch? If so then my idea may not apply - it depends on what changes were done by EA.
|
Posted By: njessen42
Date Posted: 02-June-2008 at 5:31pm
I will have to check, I didn't install the patch. Once I get to it this week I will post for sure no matter what I find out.
|
Posted By: nathan
Date Posted: 03-June-2008 at 4:33pm
I am going to test this as well. Thank you!
|
Posted By: Hamish
Date Posted: 03-June-2008 at 5:08pm
I'd love to know the comparative results. I guess a key factor will be the comparative percentages of text in the fields you are removing, compared with those you are keeping.
------------- Editing ProductCart Code?
See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code
|
Posted By: nathan
Date Posted: 03-June-2008 at 5:24pm
One quick question... my dbo.description hold our titles. Is this correct?
|
Posted By: njessen42
Date Posted: 03-June-2008 at 5:28pm
Yes that is correct, and dbo.sDesc is the short description under the title/name.
|
Posted By: nathan
Date Posted: 03-June-2008 at 5:31pm
I have the patch... which lines should I comment out to eliminate search from sdesc and details? I only want to search dbo.description
|
Posted By: Hamish
Date Posted: 03-June-2008 at 5:43pm
I have not seen the patch code. njessen42 - is the code similar & have you worked out which lines to comment out? If you would like me to take a look then let me know & I'll PM you my email address so one of you can send me the file(s).
------------- Editing ProductCart Code?
See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code
|
Posted By: njessen42
Date Posted: 03-June-2008 at 6:00pm
I looked at the code and it does look similar but currently one of our Techs is figuring it out. When they come to a conclusion I will post for sure.
|
Posted By: nathan
Date Posted: 03-June-2008 at 6:05pm
Posted By: Hamish
Date Posted: 03-June-2008 at 6:38pm
OK - I've taken a look at the patch version of the files - There's more to this search code than I thought.
I'd start by commenting out lines 395 & 486 in showsearchresults.asp, both read :
strSQL=strSQL & " OR " & tmpSQL2
A see what difference that makes - I need to get an understanding of what the XML_ and inc_ members are up to.
OK - A quick look reveals very similar code in inc_srcPrdQuery.asp - So I would comment out line 477 in that as well. That's my starter for ten - but I'll look at it further.
------------- Editing ProductCart Code?
See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code
|
Posted By: Hamish
Date Posted: 03-June-2008 at 6:45pm
I see there is also an includes/languages.asp - I assume you have both already got custom versions of that file in place. Just in case you hadn't spotted it :-)
------------- Editing ProductCart Code?
See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code
|
Posted By: Hamish
Date Posted: 03-June-2008 at 6:57pm
I suggest testing the new version of the code FIRST - before chopping it about by commenting the lines out. It will give you some figures to compare with & also prove it's working OK as delivered. One thing I didn't look at is the count of matches etc - I didn't spot where that is done - so it's worth checking that is producing the correct values as well when you comment the lines out.
------------- Editing ProductCart Code?
See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code
|
Posted By: nathan
Date Posted: 03-June-2008 at 7:41pm
It seems to me the only one I want to keep is tmpSQL2 since this is the Title? I only want to quary dbo.description.
|
Posted By: Hamish
Date Posted: 03-June-2008 at 8:13pm
Hi, I believe you are correct - Example : http://shop.rings-things.com/cart/pc/viewPrd.asp?idcategory=121&idproduct=8744 - http://shop.rings-things.com/cart/pc/viewPrd.asp?idcategory=121&idproduct=8744 You just want :- "Bead, Glass, E, Ghost (Assorted)" To be included in the search? If so then I agree.
------------- Editing ProductCart Code?
See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code
|
Posted By: nathan
Date Posted: 03-June-2008 at 9:29pm
So I am having problems figuring out what code to comment out to only search the description.
|
Posted By: nathan
Date Posted: 03-June-2008 at 9:29pm
Hamish wrote:
Hi, I believe you are correct - Example : http://shop.rings-things.com/cart/pc/viewPrd.asp?idcategory=121&idproduct=8744 - http://shop.rings-things.com/cart/pc/viewPrd.asp?idcategory=121&idproduct=8744 You just want :- "Bead, Glass, E, Ghost (Assorted)" To be included in the search? If so then I agree. |
Yes, only the title.
|
Posted By: Hamish
Date Posted: 04-June-2008 at 1:42pm
Hi Nathan, I'll take another look at the code.
------------- Editing ProductCart Code?
See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code
|
Posted By: nathan
Date Posted: 04-June-2008 at 2:18pm
Posted By: Hamish
Date Posted: 04-June-2008 at 7:14pm
OK - There's lots to this code & I'm certain it would be possible to amend it fairly radically to focus it on just the bits you want.
First thing some of the code runs via AJAX on the search page - to indicate the number of hits you will get - which is great, but maybe not for 18,000 prods - from memory (it's a few hrs since I looked, it's switched on/off depending on whether the AJAX Tooltip is enabled. I don't recall if this is the new or current version. That code will also need amending - if it IS enabld as it will give a different count from the actual search.
Anyway, onto code changes...
Look for Lines 394 & 485 :-
strSQL=strSQL & tmpSQL strSQL=strSQL & " OR " & tmpSQL2 if tIncludeSKU="true" then strSQL=strSQL & " OR " & tmpSQL3 strSQL=strSQL & " OR " & tmpSQL4 & "))" else strSQL=strSQL & " OR " & tmpSQL3 & "))" end if
And try :-
' HAM - strSQL=strSQL & tmpSQL ' HAM - strSQL=strSQL & " OR " & tmpSQL2 strSQL=strSQL & tmpSQL2 if tIncludeSKU="true" then ' HAM - strSQL=strSQL & " OR " & tmpSQL3 strSQL=strSQL & " OR " & tmpSQL4 & "))" else ' HAM - strSQL=strSQL & " OR " & tmpSQL3 & "))" strSQL=strSQL & "))" ' HAM - Added line end if
- Where 'HAM are lines I commented out - Note the EXTRA line after the last commented out line.
tmpSQL - Search of "Details" tmpSQL2 - Search of "Description" tmpSQL3 - Search of "Short Description"
tmpSQL4 - Search by SKU
I've NOT tested this code change and, of course (by design) it limits the breadth of the search.
------------- Editing ProductCart Code?
See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code
|
Posted By: nathan
Date Posted: 04-June-2008 at 7:30pm
Ill give it a try... does anything need to be done to inc_srcPrdQuery.asp ?
|
Posted By: Hamish
Date Posted: 04-June-2008 at 7:40pm
Hi, There is identical code in there as well, so I would say so.
------------- Editing ProductCart Code?
See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code
|
Posted By: nathan
Date Posted: 04-June-2008 at 8:12pm
When both files are Mod... search goes from 25 to 3 sec!
|
Posted By: Hamish
Date Posted: 04-June-2008 at 8:28pm
Cool!!! Is that a comparison of the new patch with the modified new patch?
I was expecting that there would probably be more modifications required to cut back the search code even further. Smaller changes are great as there is less to modify when new versions are released.
Do you have the AJAX enabled so that it calculates the number of hits as you type the search options in? If so, is the number correct?
------------- Editing ProductCart Code?
See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code
|
Posted By: Qwijybo
Date Posted: 05-June-2008 at 2:40pm
To eliminate the details from being searched I edited the parts of the code dealing with adding the string tmpSQL to strSQL. There are two locations in viewsearchresults.asp that need editing.
I commented these two lines then copied the first line and changed the variable to tmpSQL2. Search for "strSQL=strSQL & tmpSQL" and make the following edits.
' EDIT strSQL=strSQL & tmpSQL
' EDIT strSQL=strSQL & " OR " & tmpSQL2
strSQL=strSQL & tmpSQL2
The ' is all you need. I put in ' EDIT so I can search qucikly and easily for any edits I have made to the code.
|
Posted By: Hamish
Date Posted: 05-June-2008 at 3:23pm
Hi Qwijybo, That's pretty similar to my "fix" - Your just leaving one extra field in place (the short description).
Personally I always use an unusual word, usually the client companies name or sometimes "Hamish" to flag areas of amended code as searching for all occurances of a word such as edit gives to many hits in the full source code.
Please let us know the comparative improvement in your search times, natan had a very great improvement & it would be nice to see some other figures as well.
------------- Editing ProductCart Code?
See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code
|
Posted By: nathan
Date Posted: 12-June-2008 at 8:23pm
Hamish wrote:
Cool!!! Is that a comparison of the new patch with the modified new patch?
I was expecting that there would probably be more modifications required to cut back the search code even further. Smaller changes are great as there is less to modify when new versions are released.
Do you have the AJAX enabled so that it calculates the number of hits as you type the search options in? If so, is the number correct?
|
Ajax is enabled and displays the correct search number!
|
|