I have sphinx installed for my search engine, and it works great, but now I'm trying to add a few extra features to the search using setFilter() which should allow me to do WHERE/AND clauses, but whenever I try a search, it returns no results when there should.
This is my working code:
 require_once ( "sphinxapi.php" );
 $cl = new SphinxClient ();
 $cl->SetConnectTimeout ( 5 );
 $cl->SetMatchMode ( SPH_MATCH_BOOLEAN );
 $cl->SetSortMode ( SPH_SORT_EXPR  , "@weight" );
 $cl->SetFieldWeights ( array ( "item_title"=>100, "item_tags"=>99 ) );
 $cl->SetLimits(0, 1000, 1000, 1000);
 $cl->SetRankingMode ( SPH_RANK_PROXIMITY_BM25 );
 $cl->AddQuery( $term, "indexTubelogr" );
Now I want to start searching with QUERY - AND item_site_id = 1. I add:
$cl->SetFilter('item_site_id', 1);
Then i get the following error:
Warning: assert() [function.assert]: Assertion failed in /home/domain.com/sphinxapi.php on line 810
I also tried:
$cl->SetFilter('item_site_id', array(1));
This didn't give an error, but again, no results.
My sphinx.conf looks like:
source srcDomain
{
        type                                    = mysql
        sql_sock                                = /tmp/mysql.sock
        sql_attr_timestamp                      = item_date
        sql_ranged_throttle                     = 0
        sql_query_info                          = SELECT * FROM items WHERE item_id=$id
        sql_query                               = \
                SELECT item_id, item_date, item_runtime, item_title, item_tags, item_site_id FROM items
}
index indexDomain
{
        source                  = srcDomain
        path                    = /opt/sphinx/var/data/domain
        docinfo                 = extern
        mlock                   = 0
        morphology              = stem_en
        min_word_len            = 2
        charset_type            = sbcs
        ignore_chars            = U+00AD
        phrase_boundary         = ., ?, !, U+2026 # horizontal ellipsis
        html_strip              = 0
        preopen                 = 1
}
Can anyone please tell me what I am doing wrong?
I removed sensitive data from the code.