- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/location/search/wordstat.php
- Класс: BitrixSaleLocationSearchWordStatTable
- Вызов: WordStatTable::reInitData
static function reInitData()
{
static::cleanUp();
$totalCnt = 0;
$offset = 0;
$stat = array();
while(true)
{
$res = LocationNameLocationTable::getList(array(
'select' => array(
'NAME',
'LOCATION_ID',
'TID' => 'LOCATION.TYPE_ID'
),
'filter' => array(
'=LOCATION.TYPE.CODE' => array('CITY', 'VILLAGE', 'STREET'),
'=LANGUAGE_ID' => 'ru'
),
'limit' => self::STEP_SIZE,
'offset' => $offset
));
$cnt = 0;
while($item = $res->fetch())
{
if(strlen($item['NAME']))
{
$words = static::parseQuery($item['NAME']);
foreach($words as $k => &$word)
{
try
{
static::add(array(
'WORD' => $word,
'TYPE_ID' => $item['TID'],
'LOCATION_ID' => $item['LOCATION_ID']
));
}
catch(BitrixMainDBSqlQueryException $e)
{
// duplicate or smth
}
}
$stat['W_'.count($words)] += 1;
//_print_r($words);
}
$cnt++;
$totalCnt++;
}
if(!$cnt)
break;
$offset += self::STEP_SIZE;
}
_print_r('Total: '.$totalCnt);
_print_r($stat);
}