Пример #1
0
$l_aReturn = array();
$sph = new CSphinx(new sph_conf('3313'));
$sph->resetSphinx();
$sph->multiInit($options);
echo "\nPrforming sphinx search...\n";
foreach ($l_aTopRegions as $region) {
    $spx_lngAttrName = $aSpxSectionWhereAttr[$l_sSection]['lng'];
    $spx_latAttrName = $aSpxSectionWhereAttr[$l_sSection]['lat'];
    $sph->setGeofilter($spx_lngAttrName, $spx_latAttrName, $region['lng'], $region['lat'], $region['radius']);
    $sph->setAttribute('what', $l_sSection);
    $sph->setOptions($options);
    $temp[$id] = $region;
    $temp[$id]['count'] = $sph->addQuery();
    $id++;
    if ($id == 31) {
        $allResults = $sph->multiSearch();
        for ($i = 0; $i < sizeof($allResults); $i++) {
            $l_iTotalFound = $sph->getTotalFound($i);
            $temp[$i]['count'] = $l_iTotalFound;
            unset($temp[$i]['lat']);
            unset($temp[$i]['lng']);
            unset($temp[$i]['radius']);
        }
        $sph->resetSphinx();
        $id = 0;
        $l_aReturn = array_merge($l_aReturn, $temp);
        $temp = array();
    }
}
if ($id != 0) {
    $allResults = $sph->multiSearch();