// var_dump($categories_titles); // die(); $sph->resetSphinx(); foreach ($categories_titles as $cat_id => $category) { PrintText("\n\nCategory ID: {$cat_id}\n====================================="); $sph->multiInit(getOptions()); $stop_after = 31; // $count = 1; // foreach($category as $one_title){ for ($cat = 0; $cat < sizeof($category); $cat++) { $one_title = $category[$cat]; PrintText("{$cat}: {$one_title}"); $sph->setOptions(getOptions()); $sph->setAttribute('what', 'jobs'); $sph->setAttribute('lposition', $one_title); $sph->addQuery(); if ($cat % $stop_after == 0 && $cat != 0) { getSPHresutls($sph, &$ids, $cat_id); // PrintText("\n-------\nafter function ids:\n"); // var_dump($ids); updateDB($ids, $cat_id); unset($ids); $ids = NULL; } // $count++; } getSPHresutls($sph, &$ids, $cat_id); updateDB($ids, $cat_id); unset($ids); $ids = NULL; // PrintText("\n-------\nafter function ids:\n");
$options = array('connectTimeout' => 1, 'arrayResult' => true, 'matchMode' => SPH_MATCH_EXTENDED2, 'limits' => 1, 'page' => 1, 'index' => "i_ref_vehicles i_delta_vehicles"); $id = 0; $temp = array(); $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(); }
echo "\nPerforming sphinx search for {$l_sSection}...\n"; $l_aDealTypes = array('rent' => 0, 'sale' => 1); foreach ($l_aDealTypes as $deal_type_str => $deal_type_int) { $options = array('connectTimeout' => 1, 'arrayResult' => TRUE, 'matchMode' => SPH_MATCH_EXTENDED2, 'index' => "i_ref_realestate i_delta_realestate", 'page' => 1, 'limits' => 1); $sph->resetSphinx(); $sph->multiInit($options); $tmp_arr = array(); for ($i = 0; $i < count($cities); $i++) { $sph->setAttribute('what', $l_sSection); //don't filter for all Russia if ($i > 0) { $sph->setAttribute('lgeocity', $cities[$i]['city_name']); } $sph->setFilter($sph->VALUE_FILTER, array('l_deal_type', array($deal_type_int), FALSE)); $sph->setOptions($options); $cities[$i]['count'] = $sph->addQuery(); } $allResults = $sph->multiSearch(); for ($i = 0; $i < sizeof($allResults); $i++) { $l_iTotalFound = $sph->getTotalFound($i); $cities[$i]['count'] = $l_iTotalFound; } $result[$deal_type_str] = $cities; } if (!empty($result)) { $l_sXMLbase = '<?xml version="1.0" encoding="UTF-8"?><Top_cities_realestate></Top_cities_realestate>'; $l_sFilecity_name = "/home/eyezeek/netup/ru/seo/top_cities_" . $l_sSection . ".xml"; $l_oXML = new SimpleXMLElement($l_sXMLbase); echo "Saving to XML file {$l_sFilecity_name}...\n"; foreach ($result as $deal_type => $data) { $l_node_deal_type = $l_oXML->AddChild($deal_type);