Coreseek: Third Step call API search PHP version
There are three steps
1. It is cumbersome to tell the SEARCHD process to write a service, or to open the process every time it is called.
G:\service\coreseek\bin\searchd--install--config g:/service/coreseek/etc/csft_mysql.conf--servicename Coreseek
The same original aim is still related to the configuration file.
A parameter is the path of your searchd, the second fixed is--install, the third is the back with the configuration file--config, the third is the configuration file path is defined service name, do not write, the default is Searchd.
2. Assign the interface file, the API directory under the PHP interface file sphnixapi.php Copy to the site root directory, because you can see the source code, is actually a class
3. write file call Sphnixapi. file
coreseek Chinese full-text Search application in PHP program Coreseek Full-Text search in PHP applications
!--? phprequire (& #39; sphinxapi.php& #39;); if (isset ($_post[& #39; sub& #39;]) {$ Keyword = $_post[& #39; keyword& #39;];//receive keyword $SPH = new sphinxclient ();//Create Sphinx Object $SPH--->setserver (' localhost ', 9312 );//Connect 9312 Port/* Set Match mode Sph_match_any: Indicates that a word is matched whenever a search is broken. such as: Search engines, as long as it contains "search" or "engine" one of the words, you can match Sph_match_all: complete match. such as search "search engine", need to complete the word "search engine" to match */$SPH->setmatchmode (Sph_match_any); $result = $sph->query ($keyword, "person");//Perform a search operation. News indicates the index name. If you need to search all the indexes in csft_mysql.conf, use * instead of echo ""; Print_r ($result);//The return value is an array, first print out to see}?>