Sphinx and MySQL protocol supports application instances with SphinxQL

  • 2020-05-15 02:17:21
  • OfStack

The searchd daemon of Sphinx supports the MySQL2 base network protocol from version 0.9.9-rc2 and is accessible through the standard MySQL API.
For example, the "mysql" command line program works just fine.

Here is an example of an MySQL client to query Sphinx:


$ mysql -P 9306
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 0.9.9-dev (r1734)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> SELECT * FROM test1 WHERE MATCH('test')
-> ORDER BY group_id ASC OPTION ranker=bm25;
+------+--------+----------+------------+
| id   | weight | group_id | date_added |
+------+--------+----------+------------+
|    4 |   1442 |        2 | 1231721236 |
|    2 |   2421 |      123 | 1231721236 |
|    1 |   2421 |      456 | 1231721236 |
+------+--------+----------+------------+
3 rows in set (0.00 sec)

Opening method:
Only need to change the 1 line configuration file and add an listener protocol of mysql41:
listen = localhost:9306:mysql41

sphinx also supports a small subset of SQL, which we have nicknamed SphinxQL.
It only supports part of the syntax: such as: count(*) is not supported, if you need to find the total number of results reference: sphinxql how to get the number of results? Detailed instructions for show meta? Ampersand and so on are not supported.

Reference: use more http: / / sphinxsearch com/docs / 1.10 / sphinxql - reference. html


Related articles: