Jump to content

fulltext keyword search returning no results


jkatcherny

Recommended Posts

Hey all,

 

I've indexed the columns in my database that go with the query below, but I am not getting any results when I putting in terms that should be returning results.  Is the syntax in the query incorrect?

 

Thanks so much for any help.

 

J

 

- -

<?php
include 'config.php';
include 'opendb.php';

$keyword = $_POST['keyword'];

$query = "SELECT * FROM Composer_Info WHERE MATCH(compFirst, compLast, compNumber, compEmail, pubCoAff, whereEmployed) AGAINST('$keyword')";
$result = mysql_query($query) or die(mysql_error());
$totalComposers = mysql_num_rows($result);
$counter = 1;


echo "<center>
<table width='55%' cellpadding=0 cellspacing=6 border=0 class=style5>
<tr><td>Total composers: ".$totalComposers."</td></tr></table>
<table width='55%' cellpadding=3 cellspacing=2 border=1 class=style5>
<tr>
<td class=style4>Composer</td>
<td class=style4>Composer Number</td>
</tr>";

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{	
	$_SESSION['compLast'] = $row['compLast'];
	$_SESSION['compFirst'] = $row['compFirst'];
	$_SESSION['composerid'] = $row['composerid'];
	if ($counter % 2)
	{
		echo "<tr bgcolor='#AFBD22'><td>";	
	}
	else
	{
		echo "<tr bgcolor='#B1BE52'><td>";	
	}
	echo "<a href='composer_info.php?title=".$_SESSION['composerid']."' class='style6' target='_new'>".$_SESSION['compFirst']." ".$_SESSION['compLast']."</a></td><td>";
	echo $row['compNumber'];
	echo "</td></tr>";		
	$counter++;
}

echo "</table></center>";

include 'closedb.php';

?>

If that table doesn't have a lot of rows (i.e. 50% match), FULLTEXT doesn't work well.

 

if you are searching for a word which is very common (occurs in 50% or more than 50% of rows,mysql will return nothing.

specify which kind of search you want a boolean mode search or natural.

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.