狮身人面像。过滤器不起作用

时间:2014-11-08 10:26:39

标签: sphinx

我尝试配置Sphinx 2.1.6。当我输入单词时 - 我得到一些结果,但是当我不这样做或只搜索过滤器时 - 我有错误:

fullscan requires extern docinfo.

PHP:

require_once('/usr/share/sphinx/api/sphinxapi.php');//Include the Sphinx PHP API
    $cl = new SphinxClient();//Start the SphinxClient class 
    $cl->SetMatchMode(SPH_MATCH_EXTENDED2);//Match all words or any word?
    $cl->SetSortMode(SPH_SORT_RELEVANCE);//
    $cl->setLimits(0,10);//Works like MySQL LIMIT

    $searchWord = "*";
    if(!empty($_POST['searchData'])) {
        $searchWord = trim($_POST['searchData']);
    }
    // slider salary
    //$firePHP -> log($boo);
    if(!empty($_POST['min_salary'])){   
        $min_salary = (int)$_POST['min_salary'];
        $max_salary = (int)$_POST['max_salary'];
        $exclude = false;
        $cl->SetFilterRange('salary', $min_salary, $max_salary, $exclude);
    }  
    // filter select city []
    if(!empty($_POST['cities'])) {
        $city = $_POST['cities'];
        $exclude = false;
        $cl->SetFilter('city', $city, $exclude);
    }

Sphinx配置:

sql_query   = \
        SELECT id, occupation, experience, education, branch, 
              typeVacancy, salary, description, city, employer\
        FROM vacancy_view

    sql_attr_uint   = salary 
    sql_attr_uint   = city

1 个答案:

答案 0 :(得分:2)

您必须在索引上配置docinfo=inline

http://sphinxsearch.com/docs/current.html#conf-docinfo

需要docinfo=extern(这恰好是默认设置,因此必须更改它!)才能使全扫描工作。