Simple installation and use of sphinx in windows, and installation of sphinxwindows

Source: Internet
Author: User

Simple installation and use of sphinx in windows, and installation of sphinxwindows

1. http://sphinxsearch.com/downloads/release/, here I am using “win64 binaries w/MySQL + PgSQL + libstemmer + id64 support ", downloaded file name: sphinx-2.0.6-release-win64-id64-full.zip;

2. decompress it to D: \ sphinx, and create a directory data (used to store index files) and log (used to store log files) under D: \ sphinx; 3. Decompress D: \ sphquota. conf. copy in to D: \ sphinx \ bin \ sphinx. conf. in, and rename it sphpipeline. conf; 4. Modify D: \ sphinx \ bin \ sphinx. conf: 4.1. Search for source src1 to modify {...} content # used database type = mysql # server SQL _host = localhost # Database login name SQL _user = root # Database login password SQL _pass = root # database name for Operation SQL _db = test # database server port SQL _port = 3306 # set encoding, if UTF-8 encoding is used, SQL _query_pre = SET NAMES UTF-8 (if any of the above seven items are found before # delete them) 4.2. Search index test1 and modify {...} content # index directory path = D:/sphinx/data/# encoding charset_type = UTF-8 # specify the UTF-8 encoding table charset_table = 0 .. 9, .. z-> .. z, _, .. z, U + 410 .. U + 42F-> U + 430 .. U + 44F, U + 430 .. U + 44F # simple word segmentation, only 0 and 1. To search for Chinese characters, you must set 1 ngram_len = 1 # The characters to be segmented. When searching for Chinese characters, you must use ngram_chars = U + 3000 .. U + 2FA1F (if any of the preceding five items exist # delete them) 5. Import the test data to D: \ sph?\ example. SQL statements are executed in the test database. Note: You must specify the UTF-8 format when creating the test database. 6. Open the cmd window and enter the Directory D: \ sphinx \ bin; 7. Create an index and execute Indexer.exe test1, Test1 is the index test1 in sphexample. conf.
Sphinx 2.0.6-id64-release (r3473)Copyright (c) 2001-2012, Andrew AksyonoffCopyright (c) 2008-2012, Sphinx Technologies Inc (http://sphin using config file './sphinx.conf'...indexing index 'test1'...collected 4 docs, 0.0 MBsorted 0.0 Mhits, 100.0% donetotal 4 docs, 222 bytestotal 0.019 sec, 11252 bytes/sec, 202.74 docs/sectotal 2 reads, 0.000 sec, 0.2 kb/call avg, 0.0 msec/call avgtotal 9 writes, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
Successful... 8. Search for 'test' and execute Search.exe test
Sphinx 2.0.6-id64-release (r3473)Copyright (c) 2001-2012, Andrew AksyonoffCopyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com) using config file './sphinx.conf'...index 'test1': query 'test ': returned 3 matches of 3 total in 0.000 sec displaying matches:1. document=1, weight=2421, group_id=1, date_added=Tue Feb 26 10:25:31 2013        id=1        group_id=1        group_id2=5        date_added=2013-02-26 10:25:31        title=test one        content=this is my test document number one. also checking search within phrases.2. document=2, weight=1442, group_id=3, date_added=Tue Feb 26 10:25:31 2013        id=2        group_id=3        group_id2=6        date_added=2013-02-26 10:25:31        title= ????        content=this is my test document number two ???????3. document=4, weight=1442, group_id=2, date_added=Tue Feb 26 10:25:31 2013        id=4        group_id=2        group_id2=8        date_added=2013-02-26 10:25:31        title=doc number four        content=this is to test groups words:1. 'test': 3 documents, 4 hits index 'test1stemmed': search error: failed to open D:/sphinx/data/test1stemmed.sph: No such file or directory.
The last error can be ignored. 9. Search for Chinese characters. First, update the database content to contain Chinese characters and execute the SQL statement:
UPDATE documents SET title = 'Chinese', content = 'This is my test document number one. also checking search within phrases. contains Chinese characters. 'Where id = 1; UPDATE documents SET title = 'Chinese title', content = 'This is my test document number one. also checking search within phrases. contains Chinese content. 'Where id = 2; UPDATE documents SET title = 'Chinese title', content = 'This is my test document number one. also checking search within phrases. contains Chinese content. 'Where id = 3;
Re-create the index (step 1) and then executeSearch.exe Chinese
Sph00002.0.6-id64-release (r3473) Copyright (c) 2001-2012, Andrew AksyonoffCopyright (c) 2008-2012, sphsf-technologies Inc (http://sphinxsearch.com) using config file '. /sphworkflow. conf '... indexing index 'test1 '... collected 4 docs, 0.0 MBsorted 0.0 Mhits, 100.0% donetotal 4 docs, 349 bytestotal 0.025 sec, 13808 bytes/sec, 158.26 docs/sectotal 2 reads, 0.000 sec, 0.3 kb/call avg, 0.0 msec/call avgtotal 9 writes, 0.000 sec, 0.2 kb/call avg, 0.0 msec/call avg D: \ sph0000\ bin> search.exe Chinese sph00002.0.6-id64-release (r3473) copyright (c) 2001-2012, Andrew AksyonoffCopyright (c) 2008-2012, sphsf-technologies Inc (http://sphinxsearch.com) using config file '. /sphworkflow. conf '... index 'test1': query 'Chinese': returned 0 matches of 0 total in 0.000 sec words: index 'test1stemmed ': search error: failed to open D: /sphtasks/data/test1stemmed. 7D: No such file or directory.
No matching content is found because the GBK encoding format is used in the windows command line. We can use the PHP program to try it. 10. Go to the D: \ sphinx \ api \ directory. We can find that sphinx supports php, java, and ruby calls, and provide corresponding test examples, here we use php to copy the api to D: \ www \ and rename it as sphinxapi, because the apache web directory on my local machine is D: \ www, in D: create search under \ www \ sphinxapi. php with the following content:
<? Phprequire 'sphinxapi. php '; $ s = new SphinxClient (); $ s-> SetServer ('localhost', 9312); $ result = $ s-> Query ('China '); print_r ($ result); echo '<br/>'; $ result = $ s-> Query ('Chinese'); print_r ($ result);?>
Then return to the cmd command line, enable the sphinx service, and execute Searchd.exe(This must be executed)
Sphinx 2.0.6-id64-release (r3473)Copyright (c) 2001-2012, Andrew AksyonoffCopyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com) using config file './sphinx.conf'...WARNING: compat_sphinxql_magics=1 is deprecated; please update your applicationand configWARNING: preopen_indexes=1 has no effect with seamless_rotate=0listening on all interfaces, port=9312listening on all interfaces, port=9306precaching index 'test1'precaching index 'test1stemmed'WARNING: index 'test1stemmed': preload: failed to open D:/sphinx/data/test1stemmed.sph: No such file or directory; NOT SERVINGprecaching index 'rt'WARNING: index 'rt': preload: failed to open @CONFDIR@/data/rt.lock: No such file or directory; NOT SERVINGprecached 3 indexes in 0.018 sec
Success... then execute http: // localhost/sphinxapi/search. php In the browser. The printed array results can clearly see the search result comparison... 11. Now, the simple installation and use of sphinx in windows is complete...
How does one use php to query sphenders installed in windows? What is the array content in the query result?

You need to configure the sphexample. conf file, place the SQL statement in it, generate the corresponding index, and pass the value in the PHP code to it, and the query results will be displayed!

To install sphinx in a WAMP environment, the more detailed the instructions, the better.

Configure the Chinese search engine for sphtracing and coreseek in windows
Wenku.baidu.com/...3.html

Related Article

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.