2012-04-03 58 views
0

這是我的斯芬克斯搜索配置(sphinxsearch_0.9.9-6_amd64):Sphinxsearch索引min_stemming_len

index FULL 
{ 
    charset_type   =  utf-8 
    source     =  FULL 
    path     =  /var/sphinx/data/Full 
    docinfo     =  extern 
    mlock     =  0 
    min_stemming_len  =  1 
    min_prefix_len   =  1 
    min_word_len   =  1 
    html_strip    =  1 
    index_exact_words  =  1 

}

searchd 
{ 
    listen     =  192.168.2.3 
    log      =  /var/log/sphinxsearch/searchd.log 
    query_log    =  /var/log/sphinxsearch/query.log 
    read_timeout   =  3 
    client_timeout   =  60 
    max_children   =  30 
    pid_file    =  /var/run/searchd.pid 
    max_matches    =  1000 
    seamless_rotate   =  1 
    preopen_indexes   =  0 
    unlink_old    =  1 
    mva_updates_pool  =  1M 
    max_packet_size   =  8M 
    max_filters    =  256 
    max_filter_values  =  4096 
} 

我使用PHP作爲客戶端

$sphinx_client->SetServer('localhost', 9312); 
$sphinx_client->SetConnectTimeout(1); 
$sphinx_client->SetArrayResult(true); 
$sphinx_client->setRankingMode(SPH_RANK_WORDCOUNT); 
$sphinx_client->SetMatchMode(SPH_MATCH_EXTENDED2); 
if ($mode == 'all') { 
$sphinx_client->SetSortMode(SPH_SORT_RELEVANCE, 'category'); 
} else { 
$sphinx_client->setFilter('category', array($this->_filter_category), FALSE); 
} 
$sphinx_client->SetLimits(0, $this->_limit); 
$results = $sphinx_client->Query('"^'.$query.'$"', 'FULL'); 

例如我在索引中有這些名字: 1. Alex 2. Alen 喬治 4. 5.摹

:::當我試圖尋找簡單的1個字符的字符串「A」我得到阿倫/亞歷克斯/ A等。

如何我搜索基於字符串的長度,所以我可以在正確的順序一樣顯示出來: A /艾倫/亞歷克斯...

我也得到「警告:指數‘全’:沒有形態,index_exact_words = 1沒有影響,忽略」

問候

回答

1

使用一個序場(str2ordinal),做你的正常的搜索,但是修改排序方式:切換到擴展模式和使用相結合,比如$ sphinx_client->個SetSortMode (SPH_SORT_EXTENDED,'@weight desc,myordinal asc');

相關問題