simplification de la fonction execute
This commit is contained in:
parent
bc1a47cc5c
commit
2155ccfc3d
@ -15,6 +15,18 @@ Class Ciblage
|
||||
public $sphinx_match = SPH_MATCH_EXTENDED2;
|
||||
public $sphinx_sort = SPH_SORT_EXTENDED;
|
||||
|
||||
protected function setMinMax($name, $valeur)
|
||||
{
|
||||
if(!empty($name)) {
|
||||
$default = Fields::getMinMax($name);
|
||||
|
||||
if(empty($valeur[0])){$valeur[0] = $default[0]['min'];}
|
||||
if(empty($valeur[1])){$valeur[1] = $default[0]['max'];}
|
||||
}
|
||||
return ($valeur);
|
||||
|
||||
}
|
||||
|
||||
public function __construct($structure, $need = false)
|
||||
{
|
||||
$configuration = Zend_Registry::get('configuration');
|
||||
@ -37,22 +49,6 @@ Class Ciblage
|
||||
}
|
||||
}
|
||||
|
||||
protected function setMinMax($name, $valeur)
|
||||
{
|
||||
if(!empty($name)) {
|
||||
$default = Fields::getMinMax($name);
|
||||
|
||||
if(empty($valeur[0])){
|
||||
$valeur[0] = $default[0]['min'];
|
||||
}
|
||||
if(empty($valeur[1])){
|
||||
$valeur[1] = $default[0]['max'];
|
||||
}
|
||||
}
|
||||
return ($valeur);
|
||||
|
||||
}
|
||||
|
||||
public function calculRedevanceInsee()
|
||||
{
|
||||
$this->sphinx->SetFilter('presentrcs', array(0));
|
||||
@ -62,25 +58,10 @@ Class Ciblage
|
||||
|
||||
public function execute($need = false)
|
||||
{
|
||||
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
|
||||
|
||||
if($need) {
|
||||
$i = 0;
|
||||
$siret = array();
|
||||
|
||||
do {
|
||||
$this->sphinx->SetLimits($i, $this->nb_results, $this->max_results);
|
||||
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
|
||||
if($resSphinx['total'] > 0) {
|
||||
foreach($resSphinx['matches'] as $matches) {
|
||||
if($matches['attrs']['presentrcs'] == 0)
|
||||
$siret[] = $matches['attrs']['siren'];
|
||||
}
|
||||
$i += $this->nb_results;
|
||||
}else
|
||||
break;
|
||||
} while($i < $resSphinx['total_found']);
|
||||
return ($resSphinx['total_found']);
|
||||
} else {
|
||||
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
|
||||
return ($resSphinx);
|
||||
}
|
||||
return ($resSphinx['total_found']);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user