- Simply use the PHP API to query Sphinx index data
- $sphinx = new Sphinxclient ();
$sphinx->setserver ( ' localhost ', 9312 ); Sphinx hostname and Port //Set return result set to PHP array format $sphinx setarrayresult ( true ); //Match the offset of the result, the meaning of the parameter is: Start position, return result bar number, maximum number of matching bars $sphinx->setlimits (0, 20, 1000); //maximum search time $sphinx->setmaxquerytime; //Perform a simple search, this search will query all field information, to query the specified field please continue to see below $index = ' test1 '; //index source is the index class in the configuration file, if there are multiple index sources to use, separate the numbers: ' Email , diary ' or use the ' * ' symbol for all index sources $result = $sphinx->query (' Doc ', $ Index); echo ' <pre> '; Print_r ($result); echo ' </pre> ';
php + MySQL + Sphinx full Text Search (2)