Coreseek: Third Step call API search PHP version

Source: Internet
Author: User
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}?> 


  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.