Correction plantage prévisulation

This commit is contained in:
Michael RICOIS 2012-09-07 11:58:43 +00:00
parent 9b22b4ca3d
commit 5239c18102

View File

@ -191,23 +191,25 @@ class Ciblage
$maxMatches = 50000;
if ( $nbReturn > 0 ) {
$limit = $maxMatches = $nbReturn;
$limit = $nbReturn;
$maxMatches = $nbReturn;
//@todo : ramdom offset to display different results
}
$this->sphinx->SetLimits(0, $limit, $maxMatches);
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
$total = $resSphinx['total_found'];
//Make an array with only the data needed
$return = $this->getSiret($resSphinx);
if ( $limit<$total ) {
$total = $resSphinx['total_found'];
if ( $nbReturn == 0 && $limit<$total ) {
$max = ceil($total/$limit);
//Get siret by $limit units for each request
for($i=1; $i<$max; $i++){
$offset = $i*$limit;
$this->sphinx->SetLimits($offset, $limit, $maxMatches);
$this->sphinx->SetLimits($offset, $limit);
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
$tmpSiret = $this->getSiret($resSphinx);
$return = array_merge($return, $tmpSiret);