Remove ent_mns
This commit is contained in:
parent
443473eea4
commit
acc2b6620d
@ -14,17 +14,123 @@ if (defined('LOCAL') == false) {
|
||||
// --------------------------------------------------------------------------- //
|
||||
function nouvelleSequence(&$criteres)
|
||||
{
|
||||
if (LOCAL == true) {
|
||||
$crit2seq = file('crit2seq.prn');
|
||||
} else {
|
||||
$crit2seq = file(realpath(dirname(__FILE__)).'/crit2seq.prn');
|
||||
}
|
||||
foreach ($crit2seq as $ligne) {
|
||||
if (($pos = strpos($ligne, ';')) != false) {
|
||||
$ligne = substr($ligne, 0, $pos);
|
||||
}
|
||||
if (strstr(substr($ligne, 2, 10), $criteres) != false) {
|
||||
return str_split(substr($ligne, 13, -1), 3);
|
||||
$sequence = array(
|
||||
array( 'crit' => 'IT ', 'next' => '12' ),
|
||||
array( 'crit' => 'I ', 'next' => '00' ),
|
||||
array( 'crit' => 'I SEP ', 'next' => '12' ),
|
||||
array( 'crit' => ' T ', 'next' => '00' ),
|
||||
array( 'crit' => ' TSEP ', 'next' => '13 61 61o61p' ),
|
||||
array( 'crit' => ' D VNR', 'next' => '24 45o24o24p' ),
|
||||
array( 'crit' => ' D NR', 'next' => '21o21p' ),
|
||||
array( 'crit' => ' DL NR', 'next' => '21 21o21p' ),
|
||||
array( 'crit' => ' DLVNR', 'next' => '45 24 45o24o24p' ),
|
||||
array( 'crit' => ' P VNR', 'next' => '74 78o74o74p' ),
|
||||
array( 'crit' => ' PD VNR', 'next' => '74 78o74o74p' ),
|
||||
array( 'crit' => ' PDL NR', 'next' => '78 83o74 74o74p' ),
|
||||
array( 'crit' => ' PDLV R', 'next' => '78 81 82 77 71' ),
|
||||
array( 'crit' => ' PDLVN ', 'next' => '82 75 28 71' ),
|
||||
array( 'crit' => ' PDLVNR', 'next' => '78 74 82 78o74o82o82p' ),
|
||||
array( 'crit' => ' S ', 'next' => '30o30p' ),
|
||||
array( 'crit' => ' S R', 'next' => '72o71 71o71p' ),
|
||||
array( 'crit' => ' S N ', 'next' => '31' ),
|
||||
array( 'crit' => ' S NR', 'next' => '77 43 71' ),
|
||||
array( 'crit' => ' S V ', 'next' => '35o35p30' ),
|
||||
array( 'crit' => ' S VN ', 'next' => '75 77o75o77p75p' ),
|
||||
array( 'crit' => ' S V R', 'next' => '75 83' ),
|
||||
array( 'crit' => ' S VNR', 'next' => '43 44 75 83 61 71' ),
|
||||
array( 'crit' => ' S D ', 'next' => '40p40o61p61' ),
|
||||
array( 'crit' => ' S D R', 'next' => '45o77 77o77p' ),
|
||||
array( 'crit' => ' S D N ', 'next' => '71' ),
|
||||
array( 'crit' => ' S D NR', 'next' => '77 43 71 31' ),
|
||||
array( 'crit' => ' S D V ', 'next' => '77o40 40o' ),
|
||||
array( 'crit' => ' S D V R', 'next' => '75 72 71' ),
|
||||
array( 'crit' => ' S D VN ', 'next' => '43 41 77 71' ),
|
||||
array( 'crit' => ' S D VNR', 'next' => '44 43 49 73 75 72 71' ),
|
||||
array( 'crit' => ' S DL ', 'next' => '78 78p61p61p' ),
|
||||
array( 'crit' => ' S DL R', 'next' => '82 78 77 71' ),
|
||||
array( 'crit' => ' S DL N ', 'next' => '41 71' ),
|
||||
array( 'crit' => ' S DL NR', 'next' => '78 82 81 78p77 43 71 31' ),
|
||||
array( 'crit' => ' S DLV ', 'next' => '78 78p71' ),
|
||||
array( 'crit' => ' S DLV R', 'next' => '78 83 82 75 72 40 71' ),
|
||||
array( 'crit' => ' S DLVN ', 'next' => '78 82 78p43 71' ),
|
||||
array( 'crit' => ' S DLVNR', 'next' => '78 49 77 43 78p75 41 72 71 22' ),
|
||||
array( 'crit' => ' S P ', 'next' => '60o60p31 31o31p' ),
|
||||
array( 'crit' => ' S P R', 'next' => '45 77 41' ),
|
||||
array( 'crit' => ' S P N ', 'next' => '71 71o45 45p' ),
|
||||
array( 'crit' => ' S P NR', 'next' => '77 72 33 32' ),
|
||||
array( 'crit' => ' S P V ', 'next' => '63o45 45o45p' ),
|
||||
array( 'crit' => ' S P VN ', 'next' => '45 43 61 64' ),
|
||||
array( 'crit' => ' S P V R', 'next' => '75 83 45 35' ),
|
||||
array( 'crit' => ' S P VNR', 'next' => '77 45 44 43 73 75 72 71 41 42 40' ),
|
||||
array( 'crit' => ' S PD ', 'next' => '45 71p71o' ),
|
||||
array( 'crit' => ' S PD R', 'next' => '77 45 71' ),
|
||||
array( 'crit' => ' S PD N ', 'next' => '71 71o45 45o' ),
|
||||
array( 'crit' => ' S PD NR', 'next' => '77 76 45 41 43 40' ),
|
||||
array( 'crit' => ' S PD V ', 'next' => '45 45o71 42 42p' ),
|
||||
array( 'crit' => ' S PD V R', 'next' => '77 83 43 71 41' ),
|
||||
array( 'crit' => ' S PD VN ', 'next' => '83 75 71 44 83o75o71o44o43 41 40 40o40p' ),
|
||||
array( 'crit' => ' S PD VNR', 'next' => '77 74 45 44 43 75 71 61 63 60 40' ),
|
||||
array( 'crit' => ' S PDL ', 'next' => '71 71o71p45 45o' ),
|
||||
array( 'crit' => ' S PDL R', 'next' => '78 82 75 45 44' ),
|
||||
array( 'crit' => ' S PDL N ', 'next' => '73 48 41' ),
|
||||
array( 'crit' => ' S PDL NR', 'next' => '78 82 81 49 77 65 44 43 75 60 31' ),
|
||||
array( 'crit' => ' S PDLV ', 'next' => '78 45 45o71 42 42p40' ),
|
||||
array( 'crit' => ' S PDLV R', 'next' => '78 83 82 75 45 49 46 42 71 40' ),
|
||||
array( 'crit' => ' S PDLVN ', 'next' => '78 83 77 45 71 42 41 40' ),
|
||||
array( 'crit' => ' S PDLVNR', 'next' => '78 83 27 74 45 44 43 42 40' ),
|
||||
array( 'crit' => ' SE ', 'next' => '31o31p' ),
|
||||
array( 'crit' => ' SE R', 'next' => '72o71 71o71p' ),
|
||||
array( 'crit' => ' SE N ', 'next' => '31' ),
|
||||
array( 'crit' => ' SE NR', 'next' => '77 43 71' ),
|
||||
array( 'crit' => ' SE V ', 'next' => '35o35p30' ),
|
||||
array( 'crit' => ' SE V R', 'next' => '75 83' ),
|
||||
array( 'crit' => ' SE VN ', 'next' => '75 77' ),
|
||||
array( 'crit' => ' SE VNR', 'next' => '43 44 75 83 61 71' ),
|
||||
array( 'crit' => ' SE D ', 'next' => '40o30' ),
|
||||
array( 'crit' => ' SE D R', 'next' => '45o77' ),
|
||||
array( 'crit' => ' SE D N ', 'next' => '71' ),
|
||||
array( 'crit' => ' SE D NR', 'next' => '77 43 71 31' ),
|
||||
array( 'crit' => ' SE D V ', 'next' => '77o40' ),
|
||||
array( 'crit' => ' SE D V R', 'next' => '75 72 71' ),
|
||||
array( 'crit' => ' SE D VN ', 'next' => '43 41 77' ),
|
||||
array( 'crit' => ' SE D VNR', 'next' => '44 43 49 73 75 72 71' ),
|
||||
array( 'crit' => ' SE DL ', 'next' => '40' ),
|
||||
array( 'crit' => ' SE DL R', 'next' => '82 78 77' ),
|
||||
array( 'crit' => ' SE DL N ', 'next' => '45 43 82o45o43o43p' ),
|
||||
array( 'crit' => ' SE DL NR', 'next' => '78 82 81 46 77 43 71 31' ),
|
||||
array( 'crit' => ' SE DLV ', 'next' => '78 78o71 71o71p' ),
|
||||
array( 'crit' => ' SE DLV R', 'next' => '78 83 82 75 72 40' ),
|
||||
array( 'crit' => ' SE DLVN ', 'next' => '78 82 46 43 71' ),
|
||||
array( 'crit' => ' SE DLVNR', 'next' => '78 49 77 43 46 75 41 72 71 22' ),
|
||||
array( 'crit' => ' SEP ', 'next' => '61p31 31p30' ),
|
||||
array( 'crit' => ' SEP R', 'next' => '45 77 41' ),
|
||||
array( 'crit' => ' SEP N ', 'next' => '71 71o45 45p' ),
|
||||
array( 'crit' => ' SEP NR', 'next' => '77 72 33 32' ),
|
||||
array( 'crit' => ' SEP V ', 'next' => '63o45' ),
|
||||
array( 'crit' => ' SEP V R', 'next' => '75 83 45 35' ),
|
||||
array( 'crit' => ' SEP VN ', 'next' => '45 43 61 64' ),
|
||||
array( 'crit' => ' SEP VNR', 'next' => '77 45 44 43 73 75 72 71 41 42 40' ),
|
||||
array( 'crit' => ' SEPD ', 'next' => '45 71p' ),
|
||||
array( 'crit' => ' SEPD R', 'next' => '77 45' ),
|
||||
array( 'crit' => ' SEPD N ', 'next' => '71 71o45 40' ),
|
||||
array( 'crit' => ' SEPD NR', 'next' => '77 76 45 41 43 40' ),
|
||||
array( 'crit' => ' SEPD V ', 'next' => '45 71p71o40' ),
|
||||
array( 'crit' => ' SEPD V R', 'next' => '77 83 43 71 41 40' ),
|
||||
array( 'crit' => ' SEPD VN ', 'next' => '83 75 71 44 83o75o71o44o43 41 40 40o40p' ),
|
||||
array( 'crit' => ' SEPD VNR', 'next' => '77 74 45 44 43 75 71 61 63 60 40' ),
|
||||
array( 'crit' => ' SEPDL ', 'next' => '45 71p40' ),
|
||||
array( 'crit' => ' SEPDL R', 'next' => '78 82 75 45 44 40' ),
|
||||
array( 'crit' => ' SEPDL N ', 'next' => '73 48 41 40' ),
|
||||
array( 'crit' => ' SEPDL NR', 'next' => '78 82 81 49 77 65 44 43 75 60 31' ),
|
||||
array( 'crit' => ' SEPDLV ', 'next' => '78 45 45o71 42 42p' ),
|
||||
array( 'crit' => ' SEPDLV R', 'next' => '78 83 82 75 45 49 46 42 71 40' ),
|
||||
array( 'crit' => ' SEPDLVN ', 'next' => '78 83 77 45 71 42 41 40' ),
|
||||
array( 'crit' => ' SEPDLVNR', 'next' => '78 83 27 74 45 44 43 42 40' ),
|
||||
);
|
||||
|
||||
foreach ($sequence as $ligne) {
|
||||
if (strstr($ligne['crit'], $criteres) != false) {
|
||||
return str_split($ligne['next'], 3);
|
||||
}
|
||||
}
|
||||
return array();
|
||||
@ -36,9 +142,10 @@ function nouvelleSequence(&$criteres)
|
||||
function nouvelleCombinaison(&$sequence, &$sequencePos, $pass, &$index, &$mode)
|
||||
{
|
||||
for (;;) {
|
||||
if (isset($sequence[$sequencePos]) == false) {
|
||||
if (isset($sequence[$sequencePos]) === false) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$combinaison = trim($sequence[$sequencePos]);
|
||||
++$sequencePos;
|
||||
|
||||
@ -48,25 +155,30 @@ function nouvelleCombinaison(&$sequence, &$sequencePos, $pass, &$index, &$mode)
|
||||
|
||||
// Passage en phonetique ou en orthographique
|
||||
if (strlen($combinaison) == 3) {
|
||||
if ($pass == 2 ||
|
||||
$pass == 3) {
|
||||
if ($pass == 2 || $pass == 3) {
|
||||
continue;
|
||||
}
|
||||
$car = strtolower(substr($combinaison, 2, 1));
|
||||
|
||||
//Search Engine Version 2, we remove the orthographique
|
||||
if (SPHINX_ENT_VERSION == 2 && $car == 'o') {
|
||||
return strtolower(substr($combinaison, 0, 2));
|
||||
}
|
||||
|
||||
switch($car) {
|
||||
case 'p':
|
||||
$index = 'ent_phx';
|
||||
$mode = SPH_MATCH_EXTENDED2;
|
||||
break;
|
||||
case 'o':
|
||||
$index = 'ent_mns';
|
||||
$mode = SPH_MATCH_ISPELL;
|
||||
break;
|
||||
default:
|
||||
debugln("attention: mode inconnu: '$car'");
|
||||
case 'p':
|
||||
$index = 'ent_phx';
|
||||
$mode = SPH_MATCH_EXTENDED2;
|
||||
break;
|
||||
case 'o':
|
||||
$index = 'ent_mns';
|
||||
$mode = SPH_MATCH_ISPELL;
|
||||
break;
|
||||
default:
|
||||
debugln("attention: mode inconnu: '$car'");
|
||||
}
|
||||
} else if ($pass == 1) {
|
||||
$index = 'ent_mns';
|
||||
$index = 'ent';
|
||||
}
|
||||
|
||||
return $combinaison;
|
||||
|
@ -49,11 +49,11 @@ if (DEBUG) {
|
||||
} else {
|
||||
function debugln($ln = '')
|
||||
{
|
||||
/*
|
||||
|
||||
$fp = fopen(LOG_PATH.'/recherchesDebug.log', 'a');
|
||||
fwrite($fp, $ln.'\n');
|
||||
fwrite($fp, $ln."\n");
|
||||
fclose($fp);
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -520,12 +520,12 @@ function changePass(&$pass, &$mode, &$index, &$quorumActif, &$formR)
|
||||
case 2: // Pass 3 : Ispell
|
||||
$pass = 3;
|
||||
$mode = SPH_MATCH_ISPELL;
|
||||
$index = 'ent_mns';
|
||||
$index = 'ent';
|
||||
return true;
|
||||
case 3: // Pass 4 : Quorum n-1
|
||||
$pass = 4;
|
||||
$mode = SPH_MATCH_EXTENDED2;
|
||||
$index = 'ent_mns';
|
||||
$index = 'ent';
|
||||
$quorumActif = true;
|
||||
return true;
|
||||
case 4: // Pass 5 : Quorum n-2
|
||||
@ -1350,7 +1350,7 @@ function rechercheEnt(&$formR, $deb, $nbRep, $max, $sirenValide = false)
|
||||
|
||||
if ($total_premiere_requete == 0 ||
|
||||
$total_premiere_requete > 500) { // "huit a huit" donne 414
|
||||
$index = 'ent_mns';
|
||||
$index = 'ent';
|
||||
|
||||
// Requete sans les mots non significatifs
|
||||
// pour connaitre le nombre de mots trouves pour chaque champ alpha
|
||||
@ -1462,8 +1462,7 @@ function rechercheEnt(&$formR, $deb, $nbRep, $max, $sirenValide = false)
|
||||
$combinaison = nouvelleCombinaison($sequence, $sequencePos, $pass, $index, $mode);
|
||||
if ($combinaison == '') {
|
||||
debugln('fin des combinaisons');
|
||||
if (changePass($pass, $mode, $index,
|
||||
$quorum_actif, $formR) == true) {
|
||||
if (changePass($pass, $mode, $index, $quorum_actif, $formR) == true) {
|
||||
$criteres = 'ITSEPDLVNR';
|
||||
initSphinx($sphinx, $mode, $pass, $deb, $nbRep, $max);
|
||||
$sequencePos = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user