Correction plantage prévisulation
This commit is contained in:
parent
9b22b4ca3d
commit
5239c18102
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user