Skip to content

Instantly share code, notes, and snippets.

@barryhunter
Created December 13, 2017 12:36
Show Gist options
  • Save barryhunter/a6f46560287f082d632f7b82151cb401 to your computer and use it in GitHub Desktop.
Save barryhunter/a6f46560287f082d632f7b82151cb401 to your computer and use it in GitHub Desktop.
Duplicate ids for queries
sphinxQL>insert into pq (id,query) VALUES (12345, 'full text query terms');
Query OK, 0 rows affected (0.01 sec)
sphinxQL>pager grep 'full text query terms'
PAGER set to 'grep 'full text query terms''
sphinxQL>select * from pq;
| 1 | full text query terms | | |
| 12345 | full text query terms | | |
10024 rows in set (0.02 sec)
sphinxQL>insert into pq (query) VALUES ('full text query terms 2');
Query OK, 0 rows affected (0.00 sec)
sphinxQL>select * from pq;
| 1 | full text query terms | | |
| 12345 | full text query terms | | |
| 10024 | full text query terms 2 | | |
10025 rows in set (0.01 sec)
sphinxQL>insert into pq (id,query) VALUES (10025, 'full text query terms 3');
Query OK, 0 rows affected (0.00 sec)
sphinxQL>insert into pq (query) VALUES ('full text query terms 7');
Query OK, 0 rows affected (0.00 sec)
sphinxQL>select * from pq;
| 1 | full text query terms | | |
| 10024 | full text query terms 2 | | |
| 10025 | full text query terms 3 | | |
| 12345 | full text query terms | | |
| 10025 | full text query terms 7 | | |
10027 rows in set (0.02 sec)
sphinxQL>insert into pq (id,query) VALUES (10025, 'full text query terms 33');
Query OK, 0 rows affected (0.01 sec)
sphinxQL>select * from pq;
| 1 | full text query terms | | |
| 10024 | full text query terms 2 | | |
| 10025 | full text query terms 33 | | |
| 10025 | full text query terms 7 | | |
| 10025 | full text query terms 3 | | |
| 12345 | full text query terms | | |
10028 rows in set (0.02 sec)
sphinxQL>CALL PQ('pq','full text query terms');
ERROR 1064 (42000): bad JSON object at 1 document
sphinxQL>CALL PQ('pq','full text query terms',docs_json=0);
ERROR 1064 (42000): sphinxql: syntax error, unexpected IDENT near 'docs_json=0)'
sphinxQL>CALL PQ('pq','full text query terms', 0 AS docs_json);
2 rows in set (0.31 sec)
sphinxQL>pager cat
PAGER set to 'cat'
sphinxQL>CALL PQ('pq','full text query terms 3 7 33 2 ', 0 AS docs_json);
+-------+
| Query |
+-------+
| 1 |
| 10024 |
| 10025 |
| 10025 |
| 10025 |
| 12345 |
+-------+
6 rows in set (0.31 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment