I have Sphinx Search installed as my search engine and I'm trying to add a few extra features to the search using setFilter()
and SetSelect()
which should allow me to do WHERE/AND
clauses. But whenever I try a search, it returns no results instead of results.
Here is my sphinx.conf: http://pastebin.com/M6Kd71u0
And here's the PHP code:
require("sphinxapi.php");
$host = "localhost";
$port = 9312;
$index = "llgenre";
$select1 = "cartoon";
$label6 = "children";
$type = 4;
$limit = 20;
$ranker = SPH_RANK_PROXIMITY_BM25;
$mode = SPH_MATCH_ALL;
$sphinx = new SphinxClient();
$sphinx->setServer($host, $port);
$sphinx->setConnectTimeout(0);
$sphinx->setMatchMode($mode);
$sphinx->setRankingMode($ranker);
$sphinx->setSelect('*, select1="'.$select1.'" AND label6="'.$label6.'" AS mycond');
$sphinx->setFilter('mycond', array(1));
$res = $sphinx->query($type, $index);
die(var_dump($res));
How can I search by type = 4
, filter by select1
with cartoon
and finally on label6
with children
?