Ajout rechercheHisto
This commit is contained in:
parent
52652e6ffc
commit
53b0f6f9f3
@ -991,6 +991,54 @@ function rechercheDir(&$formR, $deb, $nbRep, $max)
|
||||
$form2crit, $deb, $ligneDir);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Recherche Histo
|
||||
// --------------------------------------------------------------------------- //
|
||||
function rechercheHisto($formR, $deb, $nbRep, $max)
|
||||
{
|
||||
global $gDatabaseJO;
|
||||
|
||||
$sphinx = clientSphinx($formR);
|
||||
|
||||
$index = 'histo';
|
||||
$mode = 'SPH_MATCH_EXTENDED';
|
||||
$pass = 0;
|
||||
initSphinx($sphinx, $mode, $pass, $deb, $nbRep, $max);
|
||||
if (!empty($formR['annee1']))
|
||||
$sphinx->SetFilter('annee1', array(0=>$formR['annee1']));
|
||||
|
||||
$sphinx->SetRankingMode ( SPH_RANK_PROXIMITY_BM25 );
|
||||
|
||||
$sphinxreturn = $sphinx->Query($formR['recherche'], $index);
|
||||
|
||||
$gDatabaseJO->select_db('histobodacc');
|
||||
|
||||
foreach ( $sphinxreturn['matches'] as $doc => $docinfo )
|
||||
{
|
||||
$requette = "SELECT Histo as Loc, id, nomFichier, annee1, bod, texte FROM bodacc_cor WHERE id=$doc";
|
||||
$req = $gDatabaseJO->query($requette);
|
||||
$ligne = $req->fetch_assoc();
|
||||
$etab = $ligne[0];
|
||||
$tabRet[] = array(
|
||||
'Localisation' => $etab['Loc'],
|
||||
'id' => $doc,
|
||||
'Pertinence' => $docinfo['weight'],
|
||||
'Fichier' => $etab['nomFichier'],
|
||||
'Annee' => $etab['annee1'],
|
||||
'Code' => $etab['bod'],
|
||||
'Texte' => $etab['texte'],
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'results' => $tabRet,
|
||||
'nbRet' => $sphinxreturn['total'],
|
||||
'nbTot' => $sphinxreturn['total_found'],
|
||||
'duration' => $sphinxreturn['time'],
|
||||
'words' => $sphinxreturn['words'],
|
||||
);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Recherche par actionnaire
|
||||
// --------------------------------------------------------------------------- //
|
||||
@ -1537,15 +1585,15 @@ function verificationDuSiret($siret)
|
||||
// --------------------------------------------------------------------------- //
|
||||
function recherche(&$formR, $deb = 0, $nbRep = 20, $max = 1000)
|
||||
{
|
||||
if ($formR['type'] == 'ent') {
|
||||
return rechercheEnt($formR, $deb, $nbRep, $max);
|
||||
} else if ($formR['type'] == 'dir') {
|
||||
return rechercheDir($formR, $deb, $nbRep, $max);
|
||||
} else if ($formR['type'] == 'act') {
|
||||
return rechercheAct($formR, $deb, $nbRep, $max);
|
||||
} else {
|
||||
debugln('Type de recherche inconnu');
|
||||
return array('nbReponses' => 0,
|
||||
if ($formR['type'] == 'ent') {
|
||||
return rechercheEnt($formR, $deb, $nbRep, $max);
|
||||
} else if ($formR['type'] == 'dir') {
|
||||
return rechercheDir($formR, $deb, $nbRep, $max);
|
||||
} else if ($formR['type'] == 'act') {
|
||||
return rechercheAct($formR, $deb, $nbRep, $max);
|
||||
} else {
|
||||
debugln('Type de recherche inconnu');
|
||||
return array('nbReponses' => 0,
|
||||
'nbReponsesTotal' => 0,
|
||||
'duree' => 0,
|
||||
'erreur' => 'Type de recherche inconnu');
|
||||
|
Loading…
Reference in New Issue
Block a user