mac007 Posted May 9, 2009 Share Posted May 9, 2009 Hello, all: Need help with this slight problem I have with a "search-box" script I am setting up... It's works fine when I do a any search like "vintage dress" or "ann taylor" but for some reason it doenst really return correct entries if I do something like "size 10" or even "size" by itself...!?? any ideas why? I thhought maybe could be cause word size was too short to be interpreted by the mysql boolean restrictions, but I thought that was at 3 letters... plus if I do "tags" it does work!! Anyways, see my code below, which is automatically being created by Dreamweaver. Perhaps the "sprintf" function is causing a problem?? Thanks in advance... $maxRows_worksRS = 12; $pageNum_worksRS = 0; if (isset($_GET['pageNum_worksRS'])) { $pageNum_worksRS = $_GET['pageNum_worksRS']; } $startRow_worksRS = $pageNum_worksRS * $maxRows_worksRS; $wordSearch_worksRS = "-1"; if (isset($_GET['wordSearch'])) { $wordSearch_worksRS = $_GET['wordSearch']; } mysql_select_db($database_artStore, $artStore); $query_worksRS = "SELECT * FROM works WHERE MATCH(Description) AGAINST ('$wordSearch_worksRS')"; $query_limit_worksRS = sprintf("%s LIMIT %d, %d", $query_worksRS, $startRow_worksRS, $maxRows_worksRS); $worksRS = mysql_query($query_limit_worksRS, $artStore) or die(mysql_error()); $row_worksRS = mysql_fetch_assoc($worksRS); Quote Link to comment https://forums.phpfreaks.com/topic/157455-why-my-search-box-script-doesnt-return-a-search-entry-like-size-6/ Share on other sites More sharing options...
Ken2k7 Posted May 9, 2009 Share Posted May 9, 2009 Edit... oops Quote Link to comment https://forums.phpfreaks.com/topic/157455-why-my-search-box-script-doesnt-return-a-search-entry-like-size-6/#findComment-830097 Share on other sites More sharing options...
Philip Posted May 9, 2009 Share Posted May 9, 2009 http://dev.mysql.com/doc/refman/4.1/en/fulltext-fine-tuning.html The minimum and maximum lengths of words to be indexed are defined by the ft_min_word_len and ft_max_word_len system variables (available as of MySQL 4.0.0). See Section 5.1.3, “Server System Variables”.) The default minimum value is four characters; the default maximum is version dependent. If you change either value, you must rebuild your FULLTEXT indexes. For example, if you want three-character words to be searchable, you can set the ft_min_word_len variable by putting the following lines in an option file:[mysqld] ft_min_word_len=3 Then you must restart the server and rebuild your FULLTEXT indexes. Note particularly the remarks regarding myisamchk in the instructions following this list. Quote Link to comment https://forums.phpfreaks.com/topic/157455-why-my-search-box-script-doesnt-return-a-search-entry-like-size-6/#findComment-830099 Share on other sites More sharing options...
mac007 Posted May 9, 2009 Author Share Posted May 9, 2009 Thanks, King... Yes, the script does return 4-letter word searches, like "tags" or "dark", but it doesnt return "size"!!! so I dont think it's a problem with length of the word... it's funny, I just tried "long 6" and it did return correct item! (whole item entry is "LAUREN MEDIUM DARK DENIM JEANS, SIZE 6 LONG, STRETCH LOWRISE").. and returned just fine... But still, if I do "size 10" or "size 6" it wont return anything... weird... Quote Link to comment https://forums.phpfreaks.com/topic/157455-why-my-search-box-script-doesnt-return-a-search-entry-like-size-6/#findComment-830115 Share on other sites More sharing options...
Philip Posted May 9, 2009 Share Posted May 9, 2009 Hmm, interesting. can you echo out $query_limit_worksRS and post what it is here? Quote Link to comment https://forums.phpfreaks.com/topic/157455-why-my-search-box-script-doesnt-return-a-search-entry-like-size-6/#findComment-830116 Share on other sites More sharing options...
mac007 Posted May 9, 2009 Author Share Posted May 9, 2009 OKIDOKI, here's what it spitted out... SELECT * FROM works WHERE MATCH(Description) AGAINST ('size 10') LIMIT 0, 12 Quote Link to comment https://forums.phpfreaks.com/topic/157455-why-my-search-box-script-doesnt-return-a-search-entry-like-size-6/#findComment-830119 Share on other sites More sharing options...
mac007 Posted May 9, 2009 Author Share Posted May 9, 2009 I think it could be something where mysql is taking that word "size" as programming code, as opposed to regular string to be searched..? otherwise why woould it find the word "long" or "tags" just fine, but not "size"... bummer Quote Link to comment https://forums.phpfreaks.com/topic/157455-why-my-search-box-script-doesnt-return-a-search-entry-like-size-6/#findComment-830120 Share on other sites More sharing options...
Philip Posted May 9, 2009 Share Posted May 9, 2009 You could try adding a +, so its +size 10 that would force it to find size in its query. Quote Link to comment https://forums.phpfreaks.com/topic/157455-why-my-search-box-script-doesnt-return-a-search-entry-like-size-6/#findComment-830123 Share on other sites More sharing options...
mac007 Posted May 9, 2009 Author Share Posted May 9, 2009 hmmm... I dont get it... I just modified one of my item's description to read "side 4" (not size 4), and it came right up when I typed "side 4"... must be the fact that it is the word "size"... or the frequency of it? since it's like in most entries... I just tried your suggestion, adding +, but nothing either... Quote Link to comment https://forums.phpfreaks.com/topic/157455-why-my-search-box-script-doesnt-return-a-search-entry-like-size-6/#findComment-830126 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.