Пример #1
0
function sphinx_liberty_results($pResults)
{
    global $gSphinxSystem, $gBitUser;
    $genericContent = new LibertyMime();
    if (!empty($pResults['matches'])) {
        $contentIds = array();
        if ($gSphinxSystem->_arrayresult) {
            for ($i = 0; $i < count($pResults['matches']); $i++) {
                $contentIds[] = $pResults['matches'][$i]['id'];
            }
        } else {
            $contentIds = array_keys($pResults['matches']);
        }
        $listHash = array('content_id_list' => $contentIds);
        $listHash['hash_key'] = 'lc.content_id';
        $listHash['include_data'] = TRUE;
        if ($conList = $genericContent->getContentList($listHash)) {
            if ($gSphinxSystem->_arrayresult) {
                for ($i = 0; $i < count($pResults['matches']); $i++) {
                    $pResults['matches'][$i] = array_merge($pResults['matches'][$i], $conList[$pResults['matches'][$i]['id']]);
                }
            } else {
                reset($contentIds);
                foreach ($contentIds as $conId) {
                    $conList[$conId]['stripped_data'] = strip_tags($genericContent->parseData($conList[$conId]['data'], $conList[$conId]['format_guid']));
                    $pResults['matches'][$conId] = array_merge($pResults['matches'][$conId], $conList[$conId]);
                    $excerptSources[] = $conList[$conId]['stripped_data'];
                }
                $gSphinxSystem->populateExcerpts($pResults, $excerptSources);
            }
        }
    }
    return $pResults;
}