Jump to content

why my "search-box" script doesnt return a search entry like "size 6" ???


mac007

Recommended Posts

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);

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.

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...

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...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.