diff --git a/.gitignore b/.gitignore index 4db36b5..4d5ee19 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ svg-pan-zoom.min.js tinycolor-min.js api/dbinit.php +api/sallesNoms.index diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..993eaa6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "api/tntsearch"] + path = api/tntsearch + url = git@github.com:teamtnt/tntsearch.git diff --git a/api/request.php b/api/request.php index 48473aa..2df4caf 100644 --- a/api/request.php +++ b/api/request.php @@ -6,9 +6,8 @@ ini_set('display_startup_errors', 1); error_reporting(E_ALL); // Se connecte à la BDD (identifiants cachés) -include 'dbinit.php'; - - +// Charge les paramètres de tnt dans $tntconfig +include_once 'dbinit.php'; if(isset($_GET["salle"])) { @@ -54,35 +53,51 @@ if(isset($_GET["salle"])) { echo (json_encode($out)); } -} else if (isset($_GET["research"])) { - $research = $_GET["research"]; - - $stmt = $conn->prepare("SELECT salleID, nom FROM salleAlias WHERE MATCH nom AGAINST (? IN BOOLEAN MODE)"); - $stmt->execute([$research]); - $res = $stmt->fetchAll(); - +} else if (isset($_GET["search"])) { + $searchText = $_GET["search"]; + $rescount = isset($_GET["rescount"])?$_GET["rescount"]:7; + + include_once 'setupTntsearch.php'; + + $tnt->selectIndex("salleSearch.index"); + $tnt->fuzziness = true; + $tnt->fuzzy_prefix_length = 2; + $tnt->fuzzy_max_expansions = 50; + $tnt->fuzzy_distance = 2; //represents the Levenshtein distance; + + $res = $tnt->search($searchText,$rescount); + $out = array(); + + for($i=0; $iprepare("SELECT nom FROM salleAlias WHERE salleID=?"); + $stmt->execute([$theid]); + $resS = $stmt->fetchAll(); + + $nomz = array(); + for($j=0;$j $res[$i]['salleID'], "name" => $res[$i]["nom"]); - + $out[$theid] = array('noms' => $nomz); + } + + for($i=0; $iprepare("SELECT personne FROM locataires WHERE salleID=?"); + $stmt->execute([$theid]); + $resL = $stmt->fetchAll(); + + $locatairez = array(); + for($j=0;$jprepare("SELECT salleID, personne FROM `locataires` WHERE MATCH personne AGAINST (? IN BOOLEAN MODE)"); - $stmt->execute([$salleLocSearch]); - $res = $stmt->fetchAll(); - - $out = array(); - - for($i=0;$i $res[$i]['salleID'], "personne" => $res[$i]["personne"]); - - echo (json_encode($out)); - -}else { +} else { echo "Je ne connais pas cette commande ..."; } diff --git a/api/setupTntsearch.php b/api/setupTntsearch.php new file mode 100644 index 0000000..25d384f --- /dev/null +++ b/api/setupTntsearch.php @@ -0,0 +1,23 @@ + loadConfig($tntconfig); diff --git a/api/tntsearch b/api/tntsearch new file mode 160000 index 0000000..1fd7b79 --- /dev/null +++ b/api/tntsearch @@ -0,0 +1 @@ +Subproject commit 1fd7b79467dffe141de3691942d11127a21c2cbd diff --git a/api/updateIndexes.php b/api/updateIndexes.php new file mode 100644 index 0000000..9b06e5d --- /dev/null +++ b/api/updateIndexes.php @@ -0,0 +1,18 @@ +createIndex('salleSearch.index'); +$indexer->query('(SELECT salleId AS id, nom AS searchText FROM salleAlias) UNION (SELECT salleId AS id, personne AS searchText FROM locataires)'); +$indexer->setLanguage('french'); +$indexer->run(); + +echo "
"; +echo "Mise à jour de l'index faite avec succès !"; diff --git a/maps/M-MGN1-4.svg b/maps/M-MGN1-4.svg index 3b99678..c1ab044 100644 --- a/maps/M-MGN1-4.svg +++ b/maps/M-MGN1-4.svg @@ -12,11 +12,12 @@ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="svg2" - width="1118" - height="3398" - viewBox="0 0 1118 3398" - sodipodi:docname="et4.svg" - inkscape:version="0.92.4 (5da689c313, 2019-01-14)"> + width="3398.0325" + height="1122.184" + viewBox="0 0 3398.0325 1122.184" + sodipodi:docname="M-MGN1-4.svg" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)" + inkscape:label="all"> @@ -44,9021 +45,1866 @@ inkscape:window-height="983" id="namedview4" showgrid="false" - inkscape:zoom="1.5715334" - inkscape:cx="104.41713" - inkscape:cy="2649.6458" + inkscape:zoom="0.27781048" + inkscape:cx="1764.4061" + inkscape:cy="330.83209" inkscape:window-x="1680" inkscape:window-y="0" inkscape:window-maximized="1" - inkscape:current-layer="svg2" /> + inkscape:current-layer="salles-group" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + x="3.0495999" + y="-3398.0327" + transform="rotate(90)" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +