hi all,
i was planning to provide my clients with different search options and realized that i could use the boolean mode of fulltext queries. After a few minutes of joy, i was devastated by the fact that it was not supported until mysql version 4.0.1 which is not available at my hosting company. sadly... 🙁
so i came up with this code to search for records containing all of the keywords specified....
$Keys=explode(" ",$Keywords);
$n_elements=count($Keys)-1;
$sql_append="MATCH(Products,Introduction,CompanyName,CompanyType) AGAINST('" . $Keys[0] . "')";
for($i=1;$i<=$n_elements;$i++){
$sql_append .= " AND MATCH(Products,Introduction,CompanyName,CompanyType) AGAINST('" . $Keys[$i] . "')";
}
$sql = "SELECT * FROM Textile WHERE " . $sql_append;
$result = mysql_query($sql, $db) or die (mysql_error());
$n = mysql_num_rows($result);
If ($n!=0){
$offset = 10;
$sql = "SELECT * FROM Textile WHERE " . $sql_append . " LIMIT $page,$offset";
$result = mysql_query($sql, $db) or die (mysql_error());
}
the problem is that it seems to scan only products, and introduction fields. for instance when i search for "silk" and "manufacturer" at the same time i can not retrieve any results (there is at least on company matching this criteria and i do not receive any error). but when i search for "silk" and "manufacture" i can retrieve three records since both of these words are included in products and introduction fields.
is this caused by the use of multiple fulltext queries at the same time? if the answer to the previous question is yes, is there any way to search for records containing all of the keywords?
any help would be appreciated.
regards...