Ajout de TNTSearch. Faut coder maintenant ...

This commit is contained in:
Mysaa
2021-10-16 17:44:32 +02:00
parent a06faec64b
commit 63ada9239a
5 changed files with 56 additions and 1 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
set_include_path(get_include_path() . PATH_SEPARATOR . './tntsearch/src/');
use TeamTNT\TNTSearch\TNTSearch;
use TeamTNT\TNTSearch\Support;
include_once 'TNTSearch.php';
include_once 'Support/AbstractTokenizer.php';
include_once 'Support/TokenizerInterface.php';
include_once 'Support/Tokenizer.php';
include_once 'Support/Collection.php';
include_once 'FileReaders/FileReaderInterface.php';
include_once 'FileReaders/TextFileReader.php';
include_once 'Indexer/TNTIndexer.php';
include_once 'Stemmer/Stemmer.php';
include_once 'Stemmer/FrenchStemmer.php';
include_once 'Stemmer/NoStemmer.php';
include_once 'Connectors/ConnectorInterface.php';
include_once 'Connectors/Connector.php';
include_once 'Connectors/MySqlConnector.php';
$tnt = new TNTSearch;
// Se connecte à la BDD (identifiants cachés)
// Charge les paramètres de tnt dans $tntconfig
include 'dbinit.php';
$tnt->loadConfig($tntconfig);
$indexer = $tnt->createIndex('sallesNoms.index');
$indexer->query('SELECT ID, nom FROM salleAlias;');
$indexer->setLanguage('french');
$indexer->setPrimaryKey('ID');
$indexer->run();
echo "Mise à jour de l'index faite avec succès !";