In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Sphinx is a full-text search engine developed by Russian Andrew Aksyonoff. It is intended to provide full-text search function with high speed, low space consumption and high result relevance for other applications. Sphinx can be easily integrated with SQL databases and scripting languages. The current system has built-in support for MySQL and PostgreSQL database data sources, and also supports reading XML data in a specific format from standard input.
Sphinx has the following features:
A) High speed indexing (on modern CPU, peak performance can reach 10 MB/ seconds)
B) High-performance search (on 2-4GB text data, the average response time per retrieval is less than 0.1s)
C) it can handle large amounts of data (it is known that it can handle more than 100 GB of text data and 100m documents on a single CPU system)
D) provide excellent correlation algorithm, compound Ranking method based on phrase similarity and statistics (BM25)
E) support for distributed search
F) support phrase search
G) provide document summary generation
H) search service can be provided as a storage engine for MySQL
I) support multiple retrieval modes such as Boolean, phrase, word similarity, etc.
J) the document supports multiple full-text retrieval fields (up to 32)
K) the document supports multiple additional attribute information (for example, grouping information, timestamp, etc.)
L) support word breakers
Although mysql's MYISAM provides full-text indexing, but the performance is not flattering, and the database is not very good at doing such a thing after all, we need to give these tasks to a more suitable program to do, reducing the pressure on the database. Therefore, it is a good choice to use Sphinx as the full-text indexing tool of mysql. This week is mainly to learn the use of this tool, the following will be a rough record of the learning process, make a memo, and hope to give some inspiration to other friends who are learning this tool.
Install sphinx
Wget http://sphinxsearch.com/files/sphinx-2.2.11-release.tar.gztar-xf sphinx-2.2.11-release.tar.gz & & cd sphinx-2.2.11-release./configure-- prefix=/usr/local/spinx-- with-mysqlmake & & make installln-s / usr/local/mysql/lib/libmysqlclient.so.18 / usr/lib64/libsphinxclient installation (required for PHP module) cd api/libsphinxclient./configure-prefix=/usr/local/sphinxmake & & make install
two。 Install the php extension
Wget http://pecl.php.net/get/sphinx-1.3.0.tgztar zxf sphinx-1.3.3.tgz & & cd sphinx-1.3.3./configure-- with-php-config=/usr/local/php/bin/php-config-- with-sphinx=/usr/local/sphinx/make & & make install
3. Create a profile
Cp / usr/local/sphinx/etc/sphinx-min.conf.dist / usr/local/sphinx/etc/sphinx.conf## Minimal Sphinx configuration sample (clean, simple Functional) # source src1 {type = mysql sql_host = localhost sql_user = root sql_pass = www.123 sql_db = test sql_port = 3306 # optional Default is 3306 sql_query =\ SELECT id, group_id, UNIX_TIMESTAMP (date_added) AS date_added, title Content\ FROM documents sql_attr_uint = group_id sql_attr_timestamp = date_added} index test1 {source = src1 path = / usr/local/spinx/var/data/test1} indexer {mem_limit = 32m} searchd {listen = 9312 listen = 9306:mysql41 log = / usr/local/spinx/var/log/searchd.log query_log = / usr/local/spinx/var/log/query.log read_timeout = 5 max_children = 30 pid_file = / usr / local/spinx/var/log/searchd.pid seamless_rotate = 1 preopen_indexes = 1 unlink_old = 1 workers = threads # for RT to work binlog_path = / usr/local/spinx/var/data}
4. Create an index and start
/ usr/local/spinx/bin/indexer-c / usr/local/spinx/etc/sphinx.conf-- all/usr/local/spinx/bin/searchd-c / usr/local/spinx/etc/sphinx.conf
5. Query verification
Cd / root/sphinx-2.2.11-release/apipython test.py testDEPRECATED: Do not call this method or, even better, use SphinxQL instead of an APIQuery 'test' retrieved 3 of 3 matches in 0.000 secQuery stats:' test' found 5 times in 3 documentsMatches:1. Doc_id=1, weight=2, group_id=1, date_added=2016-11-30 01 times in 21. Doc_id=2, weight=2, group_id=1, date_added=2016-11-3001. Doc_id=4, weight=1, group_id=2, date_added=2016-11-30 01:21:20
Mysql > select * from documents +- -+ | id | group_id | group_id2 | date_added | title | content | + -+ | 1 | 1 | 5 | 2016-11-30 01:21:20 | test one | this is my test document number one. Also checking search within phrases. | | 2 | 1 | 6 | 2016-11-30 01:21:20 | test two | this is my test document number two | | 3 | 2 | 7 | 2016-11-30 01:21:20 | another doc | this is another group | | 4 | 2 | 8 | 2016-11-30 01:21:20 | doc number four | this is to test groups | + -+
Reference website: http://blog.csdn.net/wangjiuwang/article/details/52002172
Http://www.cnblogs.com/findgor/p/5644540.html
Http://www.sphinxsearch.org/sphinx-faq
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.