Page 1 of 1

FULLTEXT search engine...need help??

Posted: Wed May 14, 2003 8:45 pm
by dazz1
I use the PHP search engine at http://www.designplace.org/ It works 100% exept for that it's not fulltext, and the results come out not the way I want so i want it to be FULLTEXT, my DB is set to be FULLTEXT and everything, I've read through every sites and throught the mysql tutorial for FULLTEXT, but i cannot get this to work, maybe its the way the script is setup or something

PLLEASEE help me!!!

thanks!!!!!!!!!!!!!

Posted: Wed May 14, 2003 11:04 pm
by McGruff
First thing I noticed is that the script uses GET as the form method - POST is much better.

You mentioned a mysql FULLTEXT tutorial: do you mean the mysql manual? See mysql.com if you don't have it - downloadable version is worth getting. There's really not much I could add to the manual notes. Have you got mysql 3.23.23 or higher? (previous versions don't support FULLTEXT searches).

Post your mysql query string if you're still stuck.

One other point: mysql 4.01 added support for the BOOLEAN option with FULLTEXT searches. In my opinion, MATCH is pretty useless without it.

A non-boolean MATCH search cannot do a whole phrase search: it will (afaik) rank results depending on the frequency of the individual words in the phrase regardless of whether they actually occur as a phrase or not (and also seems to rank the results depending on how many other words there are to "dilute" the search terms).

However, to my mind, a site search script isn't much use if you can't do a meaningful whole phrase search so if you don't have mysql 4.01 or higher I'd recommend you don't use FULLTEXT searches.

Of course site search scripts aren't much use without ranking either - could get around that with a bit of substr_count in the script.

Experiment yourself though, and see what you think.

Posted: Thu May 15, 2003 1:51 am
by dazz1
hmm thanks for saying that
i got mysql 3.23.47

i really need fulltext cause my database has stuff like for 'example'

apple.juice
or
apple_juice

when somone searches for apple juicenone of those matches come up

can you give me an example of the best query string to use for fulltext

i have 1 table and 3 fields id url and contains

the search,searches the contains field

(my site is a huge db of websites)

Posted: Thu May 15, 2003 6:11 pm
by McGruff
I don't know what FULLTEXT indexes you have defined but here's a sample which might help:

Code: Select all

<?php
$mysql = "SELECT column1,column2, MATCH (column3) AGAINST ('search text') AS score FROM table WHERE MATCH (column3) AGAINST ('search text')";
$query = mysql_query($mysql) or die("Cannot query the database.<br>" . mysql_error());

echo mysql_num_rows($query);
echo '<hr>';
while ($result = mysql_fetch_assoc($query)) {

    print_r($result);
    echo '<hr>';

}
?>
Column3 is the column you are searching in: this must have a FULLTEXT index. Cols 1 & 2 are the columns returned in the result array - along with "score" (you can display the relevance alongside the search results by echo'ing out $result['score'] in the while loop).

Posted: Fri May 16, 2003 12:20 am
by dazz1
hmm, this not working, i do the search but i always get no results now, thats what different

Is thier a free script which is a small MYSQL FULLTEXT search php script on a site or something i could use instead???

Posted: Fri May 16, 2003 12:26 am
by McGruff
Above script should work for you - it tested OK on my local server. Did you define a FULLTEXT index?

Sorry don't know any free scripts for this.

Posted: Mon May 19, 2003 3:23 pm
by dazz1
ok, i got it working, i think, FULLTEXT isntwhat i thought it was, whatever, thanks for the help