I am trying to use SphinxClient
for PHP to search for text based locations in a GeoDatabase. Here's the code that I use:
$SphinxClient=new Sphinx\SphinxClient();
$SphinxClient->setServer('myserver', 'myport');
$SphinxClient->setMatchMode(SPH_MATCH_EXTENDED2);
$result=$SphinxClient->query('@country DE', 'geonames');
$result2=$SphinxClient->query('@country US', 'geonames');
If I run the above code, $result
finds no matches, and reports no errors or warnings, $result2
finds a bunch of matches, and also reports no errors.
If I run the following two queries from command line (which should be the equivalent for the above two php client queries), they both return results:
select geonameid_attr from geonames where match('@(country) "DE"');
select geonameid_attr from geonames where match('@(country) "US"');
Here's also the relevant part from the sphinx.conf file, from which I built the sphinx table:
sql_query = SELECT geonames.geonameid, geonames.geonameid AS geonameid_attr, geonames.name AS name, geonames.asciiname AS asciiname, geonames.alternatenames AS alternatenames, geonames.country AS country, geonames.fcode AS fcode FROM geonames WHERE fcode IN ('PPL', 'PPLA', 'PPLA2', 'PPLA3', 'PPLA4', 'PPLC', 'PPLCH', 'PPLF', 'PPLG', 'PPLH', 'PPLL', 'PPLQ', 'PPLR', 'PPLS', 'PPLW', 'PPLX', 'STLMT') OR fcode LIKE 'ADM%'
sql_attr_uint = geonameid_attr
What could be the problem? Am I rusing the SphinxClient::query
function incorrectly?