Aramayis  Mkrtchyan
Aramayis Mkrtchyan

Reputation: 349

How to get global variable in sphinx search

How to get global variable in sphinx search which I have set it custom like

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

SHOW GLOBAL VARIABLES returns

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

4 rows in set (0.00 sec)

Upvotes: 1

Views: 716

Answers (1)

MartyIX
MartyIX

Reputation: 28648

Sphinx documentation http://sphinxsearch.com/docs/current.html#sphinxql-set has an example:

// 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)

So this is how you get the variable. How to show the variable content is another question and I was unable to do that. :-)

Upvotes: 1

Related Questions