如何在sphinx搜索中获取全局变量

时间:2015-10-25 08:26:43

标签: set global-variables sphinx sphinxql

如何在sphinx搜索中获取全局变量,我将其设置为自定义

SET GLOBAL @test =(1,2,3)

显示全球变量 返回

+----------------------+---------+
| Variable_name        | Value   |
+----------------------+---------+
| autocommit           | 1       |
| collation_connection | libc_ci |
| query_log_format     | plain   |
| log_level            | info    |
+----------------------+---------+

4行(0.00秒)

1 个答案:

答案 0 :(得分:1)

Sphinx文档http://sphinxsearch.com/docs/current.html#sphinxql-set有一个例子:

// in session 1
mysql> SET GLOBAL @myfilter=(2,3,5,7,11,13);
Query OK, 0 rows affected (0.00 sec)

// later in session 2
mysql> SELECT * FROM test1 WHERE group_id IN @myfilter;
+------+--------+----------+------------+-----------------+------+
| id   | weight | group_id | date_added | title           | tag  |
+------+--------+----------+------------+-----------------+------+
|    3 |      1 |        2 | 1299338153 | another doc     | 15   |
|    4 |      1 |        2 | 1299338153 | doc number four | 7,40 |
+------+--------+----------+------------+-----------------+------+
2 rows in set (0.02 sec)

所以这就是你获得变量的方式。如何显示变量内容是另一个问题,我无法做到这一点。 : - )