different fulltext search results that should be identical?

Please report bugs here!

Moderator: Thorsten

Post Reply
fledeboer
Posts: 5
Joined: Wed Jun 21, 2006 12:52 pm
Location: Bad Homburg v.d.H.
Contact:

different fulltext search results that should be identical?

Post by fledeboer »

Hello there. I hope you can help me handeling this problem...

Initial Position:
There a 11 articles including the word "problem" in the db-fields "keywords","thema" or "content". The 11 articles are found by using
phpmyadmin and a "normal" like sql statement.

Problem:
If I use the fulltext search function and search for:

1. "proble" i get a result of 12?

2. "problem" i get a result of 7 articles?

This is confusing me. Doese anybody else can reproduce this problem or better... can solve it? :-)

Regards

Flo

P.S.
I hope this has nothing to do with the stop_word_list or stupid fulltext search function within mysql.

P.P.S. Some version information:
Basis is an MySQL DB Version 4.0.18
PhpMyFAQ Version 1.6.1
PHP 4.3.4
fledeboer
Posts: 5
Joined: Wed Jun 21, 2006 12:52 pm
Location: Bad Homburg v.d.H.
Contact:

I found an other article...

Post by fledeboer »

Have a look at viewtopic.php?t=1531&highlight=suche

The problem is based on the oddly fulltext search functionality by MySQL. :-)

I "fixed" it for me by a dirty hack...

functions.php -> Line 1517 -> before the "if" syntax.

$num = 0; ;-)


But if i include this dirty hack searching with more than one word do not
reduce the result.

Hopefully someone has another solution.
fledeboer
Posts: 5
Joined: Wed Jun 21, 2006 12:52 pm
Location: Bad Homburg v.d.H.
Contact:

extend the dirty hack...

Post by fledeboer »

At line 1515 in functions.php:

Code: Select all


/** This line is new **/
    $num = 0;
/******************/

    if (0 == $num) {
        $keys = preg_split("/\s+/", $begriff);
        $numKeys = count($keys);
        $where = '';
        for ($i = 0; $i < $numKeys; $i++) {
            if (strlen($where) != 0 ) {
//                $where = $where." OR ";

//** And here the OR is changed into an AND **//
                  $where = $where." AND ";
//**************************************//

            }
            $where = $where.'('.SQLPREFIX."faqdata.thema LIKE '%".$keys[$i]."%' OR ".SQLPREFIX."faqdata.content LIKE '%".$keys[$i]."%' OR ".SQLPREFIX."faqdata.keywords LIKE '%".$keys[$i]."%') AND ".SQLPREFIX.'faqdata.active = \'yes\'';
            if (is_numeric($category)) {
                $where .= ' AND '.SQLPREFIX.'faqcategoryrelations.category_id = '.$category;
            }
        }
And that's it.

...anymore i hope for a better solution....
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Re: extend the dirty hack...

Post by matteo »

Hi fledeboer,
fledeboer wrote:...anymore i hope for a better solution....
I'm not sure what is better for you but you could try to modify the search method of the db_mysql class (inc/mysql.php) for removing the automatic boolean search with your MySQL v4.0.18:

Code: Select all

        if (version_compare($this->server_version(), '4.0.1') < 0)  {
            $against = "('".$string."')"; // Search with MySQL 3.23.23+
        } else {
            //$against = "('".$string."' IN BOOLEAN MODE)"; // Search with MySQL 4.0.1+
        }
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Post Reply