SPHINX enable_star无效

时间:2013-04-25 09:50:19

标签: php yii sphinx

我希望使用sphinx返回的结果搜索子字符串。

我的设置好吗?

我是否需要重新启动searchd进程?

index dev_jobs
{
    source      = dev_jobs_src
    path        = /home/sphinx/jobs/dev_jobs
    docinfo     = extern
    charset_type    = utf-8
    enable_star = 1
    min_infix_len = 3   
}

searchd
{
    port        = 9312
    log     = /var/log/sphinx/searchd.log
    query_log   = /var/log/sphinx/query.log
    read_timeout    = 5
    max_children    = 30
    pid_file    = /var/run/sphinx/searchd.pid
    max_matches = 100000
    seamless_rotate = 1
    preopen_indexes = 0
    unlink_old  = 1
}

和代码的php部分:

$sphinx_search = Yii::app()->search;
        $sphinx_search->setSelect('*');

        $sphinx_search_final = '';

        $sphinx_search_query = trim($this->q);
        if (strlen($sphinx_search_query) > 0) {
            $sphinx_search_query = str_replace('-', ' ', $sphinx_search_query);
            $keys = explode(' ', $sphinx_search_query);
            foreach ($keys as $k => $key) {
                if ($key) {
                    $keys[$k] = $key;
                } else {
                    unset($keys[$k]);
                }
            }
            if (count($keys) > 0) {
                $sphinx_search_final = ' @(position_name,employer_name,employer_first_name,employer_last_name,employer_position) ' . $sphinx_search_query .
                        ' @(position_name,employer_name,employer_first_name,employer_last_name,employer_position) ' . implode('|', $keys);
            }
        }

1 个答案:

答案 0 :(得分:2)

  

我是否需要重新启动搜索过程?

更重要的是,您需要重建索引。如果你使用--rotate,它会告诉searchd重新加载你的索引。