mirror of
https://gitlab.aliens-lyon.fr/savrillo/gpens.git
synced 2026-03-17 22:11:03 +01:00
Ajout de TNTSearch. Faut coder maintenant ...
This commit is contained in:
parent
a06faec64b
commit
63ada9239a
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ svg-pan-zoom.min.js
|
||||
tinycolor-min.js
|
||||
|
||||
api/dbinit.php
|
||||
api/sallesNoms.index
|
||||
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "api/tntsearch"]
|
||||
path = api/tntsearch
|
||||
url = git@github.com:teamtnt/tntsearch.git
|
||||
@ -1,14 +1,24 @@
|
||||
<?php
|
||||
|
||||
use 'tntsearch/src/TNTSearch.php'
|
||||
|
||||
// Active les erreurs PHP.
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$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('tntsearch/sallesNoms.index');
|
||||
$indexer->query('SELECT id, nom FROM sallesAlias;');
|
||||
$indexer->setLanguage('french');
|
||||
$indexer->run();
|
||||
|
||||
if(isset($_GET["salle"])) {
|
||||
|
||||
@ -57,7 +67,7 @@ if(isset($_GET["salle"])) {
|
||||
} else if (isset($_GET["research"])) {
|
||||
$research = $_GET["research"];
|
||||
|
||||
$stmt = $conn->prepare("SELECT salleID, nom FROM salleAlias WHERE MATCH nom AGAINST (? IN BOOLEAN MODE)");
|
||||
$stmt = $conn->prepare("SELECT salleID, nom FROM salleAlias WHERE MATCH nom AGAINST (? IN BOOLEAN MODE)");
|
||||
$stmt->execute([$research]);
|
||||
$res = $stmt->fetchAll();
|
||||
|
||||
|
||||
1
api/tntsearch
Submodule
1
api/tntsearch
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 1fd7b79467dffe141de3691942d11127a21c2cbd
|
||||
40
api/updateIndexes.php
Normal file
40
api/updateIndexes.php
Normal 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 !";
|
||||
Loading…
x
Reference in New Issue
Block a user