Guest Posted January 25, 2009 Share Posted January 25, 2009 Hi, I'm having some issues with the search function in my test shop and I would really like to have it working properly before launching. First issue is when the keyword starts the products description with a Capital (as in Computer for gaming purposes ...) search does not return anything on 'computer'. However, if I search on 'omputer' I get the Computer as a result. Also, if I use a description like 'This computer is ...' I get a hit on computer as well. This seems to be a case sensitivity matter, but where to go from here? :huh: Second, I have figured out that quick find only(?) looks in products_model column of products table. This will not help the average user much since products_model are the part #'s of my shop items. The average user will probably not know what part # (s)he's searching for. Trying to help up the situation a bit I enabled 'Search in description' as default so now we also search the product_description column of the products_description table (my conclusion). In my case this is not totally satisfying either since a lot of items are and will be described by their relations to other products in the shop, i.e 'This item will fit this unit and that unit'. As a result, a search on 'This item' also brings up 'this unit' and 'that unit' as well so the user will be presented a lot of irrelevant search results. My conclusion is that the best way would be to search the products_name column in the products_description table since the items names are very relevant to their respective functions and probably very well recognised among the customers. Beeing a wrench head just tripping out in the binary world I started to look how this could be done, but I've come to a dead end understanding that because the product_name is defined as varchar(64) it cannot be searched (easily?) Shop is 2.2rc2a on wamp server with utf8bin charset. I would apreciate any help in any of the above matters, please be gentle since I'm a true beginner :blush: Link to comment Share on other sites More sharing options...
wex Posted January 26, 2009 Share Posted January 26, 2009 Seems strange, test on my own shops and the "demo" shop here on Oscommerce. All handled the capital without case sensivity. Have you tried using the Phpmyadmin on your wamp server and do a LIKE %computer% - to see if its the database/charset. Where do you setup "Quick Search"? Seems to search product name/model/description/manafacturer here :) Link to comment Share on other sites More sharing options...
Guest Posted January 26, 2009 Share Posted January 26, 2009 Seems strange, test on my own shops and the "demo" shop here on Oscommerce.All handled the capital without case sensivity. Have you tried using the Phpmyadmin on your wamp server and do a LIKE %computer% - to see if its the database/charset. Where do you setup "Quick Search"? Seems to search product name/model/description/manafacturer here :) Just made some tests in phpadmin; LIKE%computer% returns any record with computer within the description, LIKE%Computer% returns any record starting with capital [C]omputer in description. So it is obviously case sensitive. Charset is when setting up the db was chosen to be utf8_bin, localhost has xp os in swedish, if that makes any sense ... Quick search or quick find or whatever, is the box in the left column. Result is the same even with advanced search. Link to comment Share on other sites More sharing options...
burt Posted January 26, 2009 Share Posted January 26, 2009 Take the input "Computer" and make sure to change it to lower case "computer" before the database search is started. Add $search_keywords = strtolower($search_keywords); Before this if (isset($search_keywords) && (sizeof($search_keywords) > 0)) { Something like that MIGHT work. Link to comment Share on other sites More sharing options...
wex Posted January 26, 2009 Share Posted January 26, 2009 Burt is a wise man! :) Still seems weird, but we atleast have located it as a database "problem". My database use latin1_swedish_ci, so you could try creating an "test" table with that charset to see if the problem is located within utf8_bin? Link to comment Share on other sites More sharing options...
Guest Posted January 26, 2009 Share Posted January 26, 2009 burt, I made the mod per your advice in advanced_search.php, the result were hits on every item in the db ... I may have to point out that the search result in phpadmin differs from the result in my shop, the shop does not return anything when keyword has a starting capital. Can I change charset on the existing db? It is still a test setup and I (of course) have backups to restore very easily if needed :rolleyes: Link to comment Share on other sites More sharing options...
burt Posted January 26, 2009 Share Posted January 26, 2009 Ah well, try the strtolower elsewhere. As this doesn't (appear to) happen in any other osCommerce shop, suggests to me that you have non-standard codebase - what changes have you made to your shop, or is this a template? Link to comment Share on other sites More sharing options...
Guest Posted January 26, 2009 Share Posted January 26, 2009 wex, you tempted me to go ahead a little so I exported the db just in case, changed charset to utf8_swedish_ci and now I get relevant results both when looking in descreption and when not (i.e. select from product_name seems to work). Neither search is case sensitive, so thats' also good :) As I said, I'm a newbie with a lot to learn. Thanks to both of you! Link to comment Share on other sites More sharing options...
burt Posted January 26, 2009 Share Posted January 26, 2009 Ah, that's interesting about the charset. Good work for getting it sorted anyway. Link to comment Share on other sites More sharing options...
Guest Posted January 26, 2009 Share Posted January 26, 2009 burt, when browsing for a crasch course on the subject I have found out that there is more to it. Charset could (should?) be set on server level, db level or table level depending on needs and application. Of course this makes sense in general to me, but I'm not able to sort out exactly how it works. Anyone who feels for it may step forward and explain the basics to me with regards to osC ;) What I did was to change charset on table level, i.e products_description and products_name in products_description table, maybe this should have been done at db level instead. Also, I wonder if the charset is optimal since I may have visitors from other Scandinavian countries like Denmark or Norway ... :wacko: Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.