Search code examples
sphinx

Sphinx. Filters doesn't work


I am try to configure Sphinx 2.1.6. When I enter word - I get some result, but when I don't do that or searching only with filters - I have error :

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 config:

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

    sql_attr_uint   = salary 
    sql_attr_uint   = city

Solution

  • You must have docinfo=inline configured on your index

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

    need docinfo=extern (which happens to be the default, so must of changed it!) for full-scans to work.