suppression configuration à compléter , issue #0001030

This commit is contained in:
Michael RICOIS 2012-01-17 16:32:20 +00:00
parent af41c36d47
commit f4204399cf
5 changed files with 6740 additions and 15 deletions

View File

@ -1,6 +1,5 @@
<?php
require_once 'sphinxapi.php';
require_once 'configuration.php';
require_once 'sphinxapi/sphinxapi-2.0.2.php';
Class Ciblage
{
@ -8,10 +7,25 @@ Class Ciblage
private $alpha = '';
private $presentRcs = 0;
public $index = 'ciblage';
public $nb_results = 5000;
public $max_results = 500000;
public $mysql_host = '192.168.78.230';
public $mysql_user = 'sphinx';
public $mysql_password = 'indexer';
public $mysql_database = 'jo';
public $sphinx_host = '192.168.78.252';
public $sphinx_port = 3312;
public $sphinx_match = SPH_MATCH_EXTENDED2;
public $sphinx_sort = SPH_SORT_EXTENDED;
public function __construct($structure, $need = false)
{
$this->sphinx = new SphinxClient();
$this->sphinx->SetServer(ConfigurationCiblage::$sphinx_host, ConfigurationCiblage::$sphinx_port);
$this->sphinx->SetServer($this->sphinx_host, $this->sphinx_port);
$this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED2);
$this->sphinx->ResetFilters();
if(!empty($structure)) {
@ -30,15 +44,11 @@ Class Ciblage
}
}
}
public function calculePriceInsee($number)
{
return (round(($number/100)*ConfigurationGenerique::$redevance_insee, 2));
}
public function calculeRedevanceInsee()
public function calculRedevanceInsee()
{
$this->sphinx->SetFilter('presentrcs', array(0));
$resSphinx = $this->sphinx->Query($this->alpha, ConfigurationCiblage::$index);
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
return ($resSphinx['total_found']);
}
@ -49,26 +59,24 @@ Class Ciblage
$siret = array();
do {
$this->sphinx->SetLimits($i, ConfigurationCiblage::$nb_results, ConfigurationCiblage::$max_results);
$resSphinx = $this->sphinx->Query($this->alpha, ConfigurationCiblage::$index);
$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 += ConfigurationCiblage::$nb_results;
$i += $this->nb_results;
}else
break;
} while($i < $resSphinx['total_found']);
return ($resSphinx['total_found']);
} else {
$resSphinx = $this->sphinx->Query($this->alpha, ConfigurationCiblage::$index);
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
}
return ($resSphinx['total_found']);
}
protected function setFilter($name, $valeur) {
if(!is_array($valeur)) {
$this->sphinx->SetFilter($name, array(intval($valeur)));

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff