Skip to content

Inaccurate results when searching two or more keywords. #309

@Sianature

Description

@Sianature

Hi all

I am using TNTsearch for mySQL database. When I search the index for two or more words, TNT gives me wrong matches with only one of the keywords in them and not both. Is there a way to fix this?

Here is how I index my database:

Indexing code
require 'vendor/autoload.php';
use TeamTNT\TNTSearch\TNTSearch;
$tnt = new TNTSearch;
$tnt->loadConfig([
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'products2023',
'username' => 'root',
'password' => '',
'storage' => 'C:\xampp2023\htdocs\Text search engines\tntsearch\indexes',
]);

$indexer = $tnt->createIndex('products2023.index');
$indexer->query('SELECT p.id,d.volume,ing.chemicals,c.CO_NAME
FROM products p
LEFT JOIN dimensions d ON d.prod_id = p.id
LEFT JOIN ingredients ing ON ing.prod_id = p.id
LEFT JOIN company c ON c.CO_NR = p.CO_NR
');
$indexer->run();

Searching code:
require 'vendor/autoload.php';
use TeamTNT\TNTSearch\TNTSearch;
include 'db_pdo_connect.php';
$tnt = new TNTSearch;

$tnt->loadConfig([
'storage' => 'C:\xampp2023\htdocs\Text search engines\tntsearch\indexes',
]);

$tnt->selectIndex("products2023.index");
$res = $tnt->search("dupont pvc",10);
#matches products that do not have 'dupont' in them

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions