I have managed to get Sphinx running to index a table with the following:
emp_id, emp_name, emp_department, emp_gender, emp_join_date, emp_notes
How do I use Sphinx to return results where emp_gender is “male”?
<?php
include ('sphinxapi.php');
$cl = new SphinxClient();
$cl->SetServer( "SPHINX2", 3312 );
$cl->SetMatchMode( SPH_MATCH_EXTENDED);
$result = $cl->Query( "male","sphinx_search");
?>
The above returns male anywhere including the emp_notes field and emp_gender field. Please advice on how I can target columns. Will something like @emp_gender male work? It does not return results as expected
You have to use the field search operator like this: