2014-10-20 24 views
0

我正在使用Sphinx來索引和搜索我的網站。在搜索字左右獲取摘要

當搜索某個單詞時,是否有辦法返回摘錄(搜索到的單詞和它周圍的一些單詞)。

現在我正在使用這個軟件包scalia

$results = SphinxSearch::search($search, $index_type); 

// I Set match, sort and ranking mode 
$results 
    ->setMatchMode($search_mode) 
    ->setSortMode($sort_mode, $sort_column) 
    ->setRankingMode(\Sphinx\SphinxClient::SPH_RANK_SPH04); 
    //set field weights 
    $results->setFieldWeights(array('title' => 10,'content'=> 5)); 

    //and get results 
    $results = $results->limit(300, 0, 1000, 100000)->query(); 

有沒有辦法管理獅身人面像返回文本的片段,它發現搜索到的關鍵字?

回答