-
-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buddy's Demon Request Registration #2964
base: master
Are you sure you want to change the base?
Buddy's Demon Request Registration #2964
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make it more simple and usable for exactly multiple test
So I suggest to remove outputs from commands and make sure that succeed by checking exit code only
curl -d 'query=select * from test' 'localhost:9308/sql?mode=raw'; echo $?
––– output –––
[{
"columns":[{"id":{"type":"long long"}},{"model":{"type":"string"}}],
"data":[
{"id":1,"model":"Test message"}
],
"total":1,
"error":"",
"warning":""
}]0
change to something
curl -d 'query=select * from test' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
Other cases also. And validate exact case that multiple queries from buddy not logged, or maybe name this test something like queries from buddy and check single queries also
…es and description to the test
@donhardman I have updated the test, but in the process noticed that requests that are not successful, that perhaps should be logged are not logged.
|
clt👎 CLT tests in test/clt-tests/core/test-buddy-requests-not-logged.rec––– input –––
rm -f /var/log/manticore/searchd.log; searchd --stopwait > /dev/null; searchd; if timeout 10 grep -qm1 '\[BUDDY\] started' <(tail -n 1000 -f /var/log/manticore/searchd.log); then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /var/log/manticore/searchd.log;fi
––– output –––
Manticore %{SEMVER} %{COMMITDATE}#!/(\sdev)?\s/!#(columnar %{SEMVER} %{COMMITDATE}) (secondary %{SEMVER} %{COMMITDATE}) (knn %{SEMVER} %{COMMITDATE})
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-%{YEAR}, Manticore Software LTD (https://manticoresearch.com)
[#!/[0-9]{2}:[0-9]{2}.[0-9]{3}/!#] [#!/[0-9]+/!#] using config file '/etc/manticoresearch/manticore.conf' (%{NUMBER} chars)...
starting daemon version '%{SEMVER} %{COMMITDATE}#!/(\sdev)?\s/!#(columnar %{SEMVER} %{COMMITDATE}) (secondary %{SEMVER} %{COMMITDATE}) (knn %{SEMVER} %{COMMITDATE})' ...
listening on %{IPADDR}:9312 for sphinx and http(s)
listening on %{IPADDR}:9306 for mysql
listening on %{IPADDR}:9308 for sphinx and http(s)
Buddy started!
––– input –––
mysql -h0 -P9306 -e "create table test (id BIGINT, model TEXT);"; echo $?
––– output –––
0
––– input –––
curl -X POST http://localhost:9308/insert -d '{"index":"test","id":1,"doc":{"model":"Test message"}}' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
curl -H 'User-agent: Manticore Buddy/1.0.0' -d 'query=select * from test' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
curl -H 'User-agent: Manticore Buddy/1.0.0' -d 'query=select * from test; show meta' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
grep -i "Manticore Buddy" /var/log/manticore/query.log
––– output –––
––– input –––
grep -E "select \* from test|show meta" /var/log/manticore/query.log
––– output –––
––– input –––
curl -H 'User-agent: Other-Agent/1.0' -d 'query=select * from test' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
grep "Other-Agent" /var/log/manticore/query.log
––– output –––
- [Expected output: Log entry with "Other-Agent"]
––– input –––
curl -H 'User-agent: Manticore Buddy/1.0.0' -d 'query=delete from test where id=1' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
grep "delete from test" /var/log/manticore/query.log
––– output –––
––– input –––
curl -H 'User-agent:' -d 'query=select * from test' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
grep -i "User-Agent" /var/log/manticore/query.log
––– output –––
––– input –––
curl -H 'User-agent: Manticore Buddy/1.0.0' -d 'query=select * from non_existent_table' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
grep "non_existent_table" /var/log/manticore/query.log
––– output –––
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK, just some questions and we can remove # in front of text in the top of the file
clt❌ CLT tests in test/clt-tests/buddy/test-fuzzy-search.rec––– input –––
rm -f /var/log/manticore/searchd.log; searchd --stopwait > /dev/null; searchd; if timeout 10 grep -qm1 '\[BUDDY\] started' <(tail -n 1000 -f /var/log/manticore/searchd.log); then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /var/log/manticore/searchd.log;fi
––– output –––
Manticore %{VERSION} (columnar %{VERSION}) (secondary %{VERSION}) (knn %{VERSION})
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-%{YEAR}, Manticore Software LTD (https://manticoresearch.com)
[#!/[0-9]{2}:[0-9]{2}.[0-9]{3}/!#] [#!/[0-9]+/!#] using config file '/etc/manticoresearch/manticore.conf' (%{NUMBER} chars)...
starting daemon version '%{VERSION} (columnar %{VERSION}) (secondary %{VERSION}) (knn %{VERSION})' ...
listening on %{IPADDR}:9312 for sphinx and http(s)
listening on %{IPADDR}:9306 for mysql
listening on %{IPADDR}:9308 for sphinx and http(s)
Buddy started!
––– input –––
apt-get update -y > /dev/null; echo $?
––– output –––
0
––– input –––
apt-get install jq -y > /dev/null; echo $?
––– output –––
debconf: delaying package configuration, since apt-utils is not installed
0
––– input –––
php -d memory_limit=2G ./test/clt-tests/scripts/load_names_attr.php --batch-size=100000 --concurrency=4 --docs=1000000 --start-id=1 --min-infix-len=2 > /dev/null; echo $?
––– output –––
0
––– input –––
mysql -h0 -P9306 -e "SHOW CREATE TABLE name;" | grep "min_infix_len='2'" | sed "s/.*\(min_infix_len='2'\).*/\1/"
––– output –––
min_infix_len='2'
––– input –––
mysql -h0 -P9306 -e "SELECT COUNT(*) FROM name;"
––– output –––
+----------+
| count(*) |
+----------+
| 1000000 |
+----------+
––– input –––
mysql -h0 -P9306 -e "OPTIMIZE TABLE name OPTION sync=1;"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('RICH') ORDER BY id ASC, username ASC OPTION fuzzy=1;"
––– output –––
+------+-------------------+------+
| id | username | s |
+------+-------------------+------+
| 196 | BRICE MULLIN | a |
| 307 | GRICELDA SKELTON | a |
| 363 | LAURICE SOLIZ | a |
| 478 | ERICH LLAMAS | a |
| 490 | LATRICE MANCILLA | a |
| 608 | MAURICE PRATHER | a |
| 659 | BRICE OLIVARES | a |
| 697 | PATRICE WOOD | a |
| 822 | JUNITA RICHARD | a |
| 835 | AUREA RICO | a |
| 854 | ROXANNE BRICE | a |
| 1122 | RICH MOLL | a |
| 1134 | JOELLA RICHARD | a |
| 1160 | MINDY HEINRICH | a |
| 1224 | YADIRA RICHARDSON | a |
| 1379 | BRICE ALLMAN | a |
| 1574 | RICO VALENZUELA | a |
| 1602 | BEATRICE LOVE | a |
| 1822 | RICHELLE ROE | a |
| 2136 | CHIQUITA RICHTER | a |
+------+-------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('EBGRNA') ORDER BY id ASC, username ASC OPTION fuzzy=1;"
––– output –––
+------+----------------------+------+
| id | username | s |
+------+----------------------+------+
| 675 | CONCEPTION ABERNATHY | a |
| 964 | BERNARDINA OSHEA | a |
| 1354 | VERNA VITALE | a |
| 1784 | BERNADETTE HALES | a |
| 1839 | BERNARDINA MCMILLAN | a |
| 1864 | ERNA ULLOA | a |
| 1948 | SAMIRA ABERNATHY | a |
| 2238 | JUDI BERNAL | a |
| 2446 | MERNA GAITHER | a |
| 3065 | BERNADINE HIBBARD | a |
| 3195 | BERNADETTE SHELTON | a |
| 3688 | VERNA GASTON | a |
| 3781 | BERNARDINE WILKINS | a |
| 4370 | ERNA VITALE | a |
| 4637 | TARSHA HERNANDEZ | a |
| 4662 | FERNANDO HOUCK | a |
| 5044 | CONSTANCE ABERNATHY | a |
| 5580 | LAVERNA GORMAN | a |
| 5582 | FERNANDE ISRAEL | a |
| 5798 | LAVERNA STORM | a |
+------+----------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('ANT') ORDER BY id ASC, username ASC OPTION fuzzy=1;"
––– output –––
+------+-------------------+------+
| id | username | s |
+------+-------------------+------+
| 8 | DAMIAN SOMERS | a |
| 16 | TAMI WHELAN | a |
| 19 | DARCY SANDBERG | a |
| 20 | RANEE BROUGHTON | a |
| 21 | STEPHEN ALLMAN | a |
| 30 | AMANDA KEY | a |
| 37 | ELFRIEDA HANKS | a |
| 41 | NANNIE WILLINGHAM | a |
| 42 | YOULANDA TROUT | a |
| 44 | ANTHONY SMOOT | a |
| 47 | FRANCIE BUNDY | a |
| 51 | LATASHA POLAND | a |
| 53 | SHEMEKA DURAND | a |
| 54 | LATANYA ARNDT | a |
| 56 | JANELLE LASTER | a |
| 57 | NANNIE HANNON | a |
| 58 | GRANVILLE VALDEZ | a |
| 59 | DEDE SPANN | a |
| 60 | DANIEL MERRITT | a |
| 63 | SAUL HOWLAND | a |
+------+-------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('tony') ORDER BY id ASC, username ASC OPTION fuzzy=1;"
––– output –––
+------+--------------------+------+
| id | username | s |
+------+--------------------+------+
| 118 | ANTONIA VANWINKLE | a |
| 220 | ANTONIA MELGAR | a |
| 391 | KARYL TONEY | a |
| 761 | TONYA SHERRILL | a |
| 1527 | LEONE TONEY | a |
| 2132 | TONIA RAPP | a |
| 2195 | TONIE HOANG | a |
| 2333 | LATONIA VILLASENOR | a |
| 2357 | TONIE BARNHILL | a |
| 2430 | TONIA BOSTICK | a |
| 2584 | TONI SPENCE | a |
| 2725 | ANTONIETTA CINTRON | a |
| 2881 | ANTONINA HASKELL | a |
| 3318 | TONY DUPRE | a |
| 3582 | ANTONIETTA BAEZ | a |
| 3858 | TONEY SCHOEN | a |
| 4366 | ROCHEL TONEY | a |
| 4608 | ANTONIA DRISCOLL | a |
| 4657 | TONYA PARRIS | a |
| 4800 | TONY WEISS | a |
+------+--------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SMITH') ORDER BY id DESC, username ASC OPTION fuzzy=1;"
––– output –––
+--------+-------------------+------+
| id | username | s |
+--------+-------------------+------+
| 999973 | KEITH SNOW | a |
| 999855 | DOROTHA WISEMAN | a |
| 999723 | SCOTT OLSON | a |
| 999264 | RUTHANN GREENE | a |
| 999250 | MINH LANDERS | a |
| 999127 | MALENA RUTHERFORD | a |
| 999120 | RUTHANNE CARDOSO | a |
| 998893 | IRWIN SOUTHARD | a |
| 998691 | MITCHELL SEITZ | a |
| 998539 | ELSA SEITZ | a |
| 998526 | SCOTT CARRION | a |
| 997945 | RUTHE SCHENK | a |
| 997815 | MINH GOODWIN | a |
| 997558 | ARTIE SOUTH | a |
| 997189 | BETTY SOUTHERN | a |
| 997187 | SUSAN SCOTT | a |
| 997098 | OTHA FAJARDO | a |
| 997074 | SCOTT FLANDERS | a |
| 996804 | SCOTT ENOS | a |
| 996461 | EDRA HIGGINBOTHAM | a |
+--------+-------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SMITH') ORDER BY id DESC, username ASC OPTION fuzzy=1;"
––– output –––
+--------+-------------------+------+
| id | username | s |
+--------+-------------------+------+
| 999973 | KEITH SNOW | a |
| 999855 | DOROTHA WISEMAN | a |
| 999723 | SCOTT OLSON | a |
| 999264 | RUTHANN GREENE | a |
| 999250 | MINH LANDERS | a |
| 999127 | MALENA RUTHERFORD | a |
| 999120 | RUTHANNE CARDOSO | a |
| 998893 | IRWIN SOUTHARD | a |
| 998691 | MITCHELL SEITZ | a |
| 998539 | ELSA SEITZ | a |
| 998526 | SCOTT CARRION | a |
| 997945 | RUTHE SCHENK | a |
| 997815 | MINH GOODWIN | a |
| 997558 | ARTIE SOUTH | a |
| 997189 | BETTY SOUTHERN | a |
| 997187 | SUSAN SCOTT | a |
| 997098 | OTHA FAJARDO | a |
| 997074 | SCOTT FLANDERS | a |
| 996804 | SCOTT ENOS | a |
| 996461 | EDRA HIGGINBOTHAM | a |
+--------+-------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SMYTH') ORDER BY id DESC, username ASC OPTION fuzzy=1;"
––– output –––
+--------+-------------------+------+
| id | username | s |
+--------+-------------------+------+
| 999973 | KEITH SNOW | a |
| 999964 | CANDACE BOOTH | a |
| 999855 | DOROTHA WISEMAN | a |
| 999723 | SCOTT OLSON | a |
| 999264 | RUTHANN GREENE | a |
| 999197 | HEATH MCNAMARA | a |
| 999127 | MALENA RUTHERFORD | a |
| 999120 | RUTHANNE CARDOSO | a |
| 999013 | HEATHER HAMMOCK | a |
| 998893 | IRWIN SOUTHARD | a |
| 998526 | SCOTT CARRION | a |
| 998000 | EDYTH CARLISLE | a |
| 997945 | RUTHE SCHENK | a |
| 997558 | ARTIE SOUTH | a |
| 997544 | HEATHER CLAUSEN | a |
| 997189 | BETTY SOUTHERN | a |
| 997187 | SUSAN SCOTT | a |
| 997098 | OTHA FAJARDO | a |
| 997074 | SCOTT FLANDERS | a |
| 996804 | SCOTT ENOS | a |
+--------+-------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SMITH') ORDER BY id DESC, username ASC OPTION fuzzy="1";"
––– output –––
+--------+-------------------+------+
| id | username | s |
+--------+-------------------+------+
| 999973 | KEITH SNOW | a |
| 999855 | DOROTHA WISEMAN | a |
| 999723 | SCOTT OLSON | a |
| 999264 | RUTHANN GREENE | a |
| 999250 | MINH LANDERS | a |
| 999127 | MALENA RUTHERFORD | a |
| 999120 | RUTHANNE CARDOSO | a |
| 998893 | IRWIN SOUTHARD | a |
| 998691 | MITCHELL SEITZ | a |
| 998539 | ELSA SEITZ | a |
| 998526 | SCOTT CARRION | a |
| 997945 | RUTHE SCHENK | a |
| 997815 | MINH GOODWIN | a |
| 997558 | ARTIE SOUTH | a |
| 997189 | BETTY SOUTHERN | a |
| 997187 | SUSAN SCOTT | a |
| 997098 | OTHA FAJARDO | a |
| 997074 | SCOTT FLANDERS | a |
| 996804 | SCOTT ENOS | a |
| 996461 | EDRA HIGGINBOTHAM | a |
+--------+-------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('john') ORDER BY id DESC, username ASC OPTION fuzzy=1;"
––– output –––
+--------+------------------------+------+
| id | username | s |
+--------+------------------------+------+
| 999961 | JONELL ENRIGHT | a |
| 999932 | JONELL NIX | a |
| 999926 | JONAH BURNSIDE | a |
| 999922 | LAVONNA JONAS | a |
| 999860 | JOHNETTA DO | a |
| 999552 | JOHNNY CARNES | a |
| 999548 | JOHNATHAN PEPPER | a |
| 999509 | JOHNATHAN STUBBLEFIELD | a |
| 999171 | JOHNNY ABRAMS | a |
| 999033 | AGNUS STJOHN | a |
| 998835 | SCARLETT JONAS | a |
| 998798 | JOHNATHON READ | a |
| 998467 | JOHNSON JEAN | a |
| 998393 | JOHN BACH | a |
| 998306 | JOHNNY TAFOYA | a |
| 998304 | JONG SAUER | a |
| 998303 | JONATHON DUPRE | a |
| 998278 | JOHNNIE LOR | a |
| 998181 | JONA ELROD | a |
| 998154 | JONG YORK | a |
+--------+------------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('jane') AND id BETWEEN 10000 AND 20000 ORDER BY username ASC OPTION fuzzy=1;"
––– output –––
+-------+--------------------+------+
| id | username | s |
+-------+--------------------+------+
| 10028 | ANJANETTE PORTILLO | a |
| 10056 | JANETTE LYNCH | a |
| 10629 | LANETTE SWAIN | a |
| 10874 | JANESSA MONTEZ | a |
| 10977 | RUTHANN LANEY | a |
| 11038 | DESIRE LANE | a |
| 11056 | LANELLE WATTS | a |
| 11397 | MELITA LANE | a |
| 11415 | MARYJANE HOLTZ | a |
| 11569 | JANETH SELBY | a |
| 11758 | JANETTE GANTT | a |
| 11834 | JANELLE DRIGGERS | a |
| 12100 | JAE COBLE | a |
| 12171 | JAE MEARS | a |
| 12185 | JANESSA BALTAZAR | a |
| 12237 | JANENE APODACA | a |
| 12490 | LANELLE ARNDT | a |
| 12536 | JANENE WALDRON | a |
| 12540 | ANJANETTE STAGGS | a |
| 12642 | HERSHEL LANEY | a |
+-------+--------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('EBGRNA') AND id BETWEEN 1000 AND 2000 ORDER BY username ASC OPTION fuzzy=1;"
––– output –––
+------+---------------------+------+
| id | username | s |
+------+---------------------+------+
| 1354 | VERNA VITALE | a |
| 1784 | BERNADETTE HALES | a |
| 1839 | BERNARDINA MCMILLAN | a |
| 1864 | ERNA ULLOA | a |
| 1948 | SAMIRA ABERNATHY | a |
+------+---------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SARA') ORDER BY id ASC, username ASC OPTION fuzzy=1;"
––– output –––
+------+------------------+------+
| id | username | s |
+------+------------------+------+
| 188 | LARA KIRK | a |
| 207 | CLARA MORRIS | a |
| 351 | KLARA DONALDSON | a |
| 990 | ELAINE SARABIA | a |
| 1409 | LARA FREDERICK | a |
| 1661 | SARA GARNER | a |
| 1831 | SARAI ESPINAL | a |
| 2074 | VALENTIN SARABIA | a |
| 2930 | LARA CINTRON | a |
| 3045 | KLARA ANDRES | a |
| 3373 | KLARA NORTON | a |
| 3741 | CRUZ SARABIA | a |
| 3780 | RUSSEL LARA | a |
| 4700 | HEE SARABIA | a |
| 4933 | KLARA GOODING | a |
| 5830 | SARAI LINDLEY | a |
| 5865 | SARAN KNAPP | a |
| 5918 | SARA WAITE | a |
| 6635 | CLARA BEALE | a |
| 6836 | CLARA BAZAN | a |
+------+------------------+------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS fuzziness);" | tail -n +4 | sort
––– output –––
+---------+
| joe |
| john |
| johnie |
| johnson |
| jordan |
| jose |
| joseph |
| joshua |
| joy |
| joyce |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'us,ru' AS layouts);" | tail -n +4 | sort
––– output –––
+---------+
| joe |
| john |
| johnie |
| johnson |
| jordan |
| jose |
| joseph |
| joshua |
| joy |
| joyce |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append);" | tail -n +4 | sort
––– output –––
+---------+
| joe |
| john |
| johnie |
| johnson |
| jordan |
| jose |
| joseph |
| joshua |
| joy |
| joyce |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 0 AS prepend);" | tail -n +4 | sort
––– output –––
+---------+
| joe |
| john |
| johnson |
| jonas |
| jordan |
| jose |
| joseph |
| joshua |
| joy |
| joyce |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS prepend, 1 AS append);" | tail -n +4 | sort
––– output –––
+---------+
| joe |
| john |
| johnie |
| johnson |
| jordan |
| jose |
| joseph |
| joshua |
| joy |
| joyce |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS fuzziness, '' AS layouts, 1 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
+---------+
| joe |
| john |
| johnie |
| johnson |
| jordan |
| jose |
| joseph |
| joshua |
| joy |
| joyce |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 2 AS fuzziness, 'us,ru' AS layouts, 1 AS append, 1 AS prepend, 2 AS expansion_len);" | tail -n +4 | sort
––– output –––
+-------+
| joe |
| john |
| jose |
| joy |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append);" | tail -n +4 | sort
––– output –––
+---------+
| joe |
| john |
| johnie |
| johnson |
| jordan |
| jose |
| joseph |
| joshua |
| joy |
| joyce |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS prepend);" | tail -n +4 | sort
––– output –––
+---------+
| joe |
| john |
| johnie |
| johnson |
| jordan |
| jose |
| joseph |
| joshua |
| joy |
| joyce |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
+---------+
| joe |
| john |
| johnie |
| johnson |
| jordan |
| jose |
| joseph |
| joshua |
| joy |
| joyce |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'us' AS layouts);" | tail -n +4 | sort
––– output –––
+---------+
| joe |
| john |
| johnie |
| johnson |
| jordan |
| jose |
| joseph |
| joshua |
| joy |
| joyce |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'ru' AS layouts);" | tail -n +4 | sort
––– output –––
+---------+
| joe |
| john |
| johnie |
| johnson |
| jordan |
| jose |
| joseph |
| joshua |
| joy |
| joyce |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('al', 'name', 0 AS fuzziness);" | tail -n +4 | sort
––– output –––
+-----------+
| albert |
| alexander |
| allen |
| dale |
| dallas |
| donald |
| gale |
| kendall |
| marshall |
| walter |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('mi', 'name', 0 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
+---------+
| ami |
| britni |
| brittni |
| cami |
| choi |
| darci |
| eleni |
| jami |
| jani |
| jeni |
| joi |
| kaci |
| kami |
| kimi |
| laci |
| lani |
| luci |
| mancini |
| marci |
| martini |
| melani |
| muoi |
| nanci |
| neomi |
| noemi |
| nohemi |
| ricci |
| shani |
| staci |
| tammi |
| toi |
| tomi |
| traci |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('ch', 'name', 1 AS fuzziness, 3 AS expansion_len);" | tail -n +4 | sort
––– output –––
+-------+
| chang |
| chi |
| chong |
| chung |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('зф', 'name', 'us,ru' AS layouts);" | tail -n +4 | sort
––– output –––
+---------+
| page |
| paige |
| palma |
| palmer |
| paris |
| parker |
| pat |
| patrick |
| paul |
| paz |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('зф', 'name', 'us' AS layouts);" | tail -n +4 | sort
––– output –––
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('gr', 'name', 1 AS fuzziness, 'ru' AS layouts, 1 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
+------------+
| grace |
| gracia |
| grady |
| graham |
| grant |
| gregg |
| gregory |
| griffin |
| grover |
| montenegro |
––– input –––
mysql -h0 -P9306 -e "drop table if exists t; create table t(f text) min_infix_len='2'; insert into t values(1, 'something'), (2, 'some thing'); select * from t where match('somethin') option fuzzy=0;"
––– output –––
––– input –––
mysql -h0 -P9306 -e "select * from t where match('somethin') option fuzzy=0;"
––– output –––
––– input –––
mysql -P9306 -h0 -e "drop table if exists t; create table t(f text) min_infix_len='2'; insert into t values(1, 'something'), (2, 'some thing'); call autocomplete('some', 't');"
––– output –––
+-----------+
| query |
+-----------+
| some |
| something |
+-----------+
––– input –––
mysql -P9306 -h0 -e "drop table if exists t; create table t(f text) min_infix_len='2'; insert into t values(1, 'something'), (2, 'some thing'); call autocomplete('some', 't');"
––– output –––
+-----------+
| query |
+-----------+
| some |
| something |
+-----------+
––– input –––
mysql -h0 -P9306 -e "drop table if exists t; create table t(a int);"
––– output –––
––– input –––
mysql -h0 -P9306 -e "select * from t option fuzzy=1;"
––– output –––
ERROR 1064 (42000) at line 1: The 'fuzzy' option requires a full-text query
––– input –––
mysql -h0 -P9306 -e "drop table if exists comment_28798446; create table comment_28798446(id int, content text) min_infix_len='3';"
––– output –––
––– input –––
mysql -h0 -P9306 -e "insert into comment_28798446 values (1, 'business Manticore interaction'), (2, 'buisness Manticore interation'), (3, 'other text content');"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SELECT id FROM comment_28798446 WHERE MATCH('buisness Manticore interation') OPTION fuzzy = 1, layouts = '';"
––– output –––
+------+
| id |
+------+
| 1 |
| 2 |
+------+
––– input –––
mysql -h0 -P9306 -e "SELECT id FROM comment_28798446 WHERE MATCH('business Manticore interaction') OPTION fuzzy = 1, layouts = '';"
––– output –––
+------+
| id |
+------+
| 1 |
| 2 |
+------+
––– input –––
mysql -h0 -P9306 -e "SELECT id FROM comment_28798446 WHERE MATCH('Manticore') OPTION fuzzy = 1, layouts = '';"
––– output –––
+------+
| id |
+------+
| 1 |
| 2 |
+------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('bus', 'comment_28798446', 'ru,us,ua' AS layouts);"
––– output –––
+----------+
| query |
+----------+
| business |
+----------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('bus', 'comment_28798446', '' AS layouts);"
––– output –––
+----------+
| query |
+----------+
| business |
+----------+
––– input –––
mysql -h0 -P9306 -e "DROP TABLE IF EXISTS t; CREATE TABLE t(f TEXT) min_infix_len='2';"
––– output –––
+ ERROR 1064 (42000) at line 1: error adding table 't': directory is not empty: /var/lib/manticore/t
––– input –––
mysql -h0 -P9306 -e "INSERT INTO t VALUES (1, 'abcdef'), (2, 'abcd efgh');"
––– output –––
+ ERROR 1064 (42000) at line 1: Cannot create table with column names missing
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('abcdef'); SHOW META;"
––– output –––
- +------+--------+
+ ERROR 1064 (42000) at line 1: unknown local table(s) 't' in search request
- | id | f |
- +------+--------+
- | 1 | abcdef |
- +------+--------+
- +----------------+--------+
- | Variable_name | Value |
- +----------------+--------+
- | total | 1 |
- | total_found | 1 |
- | total_relation | eq |
- | time | #!/[0-9]{1}.[0-9]{3}/!# |
- | keyword[0] | abcdef |
- | docs[0] | 1 |
- | hits[0] | 1 |
- +----------------+--------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('abcef') OPTION fuzzy=1; SHOW META;"
––– output –––
- +------+-----------+
+ ERROR 1064 (42000) at line 1: unknown local table(s) 't' in search request
- | id | f |
- +------+-----------+
- | 1 | abcdef |
- | 2 | abcd efgh |
- +------+-----------+
- +----------------+-------+
- | Variable_name | Value |
- +----------------+-------+
- | total | 2 |
- | total_found | 2 |
- | total_relation | eq |
- | time | #!/[0-9]{1}.[0-9]{3}/!# |
- +----------------+-------+
––– input –––
grep -A3 "SELECT \* FROM t WHERE MATCH('abcdef')" /var/log/manticore/query.log
––– output –––
- /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (127.0.0.1:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found 1 */ SELECT * FROM t WHERE MATCH('abcdef');
+ /* Tue Jan 28 18:45:32.013 2025 conn 79 (127.0.0.1:55020) real 0.000 wall 0.000 found 0 */ SELECT * FROM t WHERE MATCH('abcdef'); /*error=unknown local table(s) 't' in search request */
- /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (127.0.0.1:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found 2 */ SELECT * FROM t WHERE MATCH('abcef') OPTION fuzzy=1;
+ /* Tue Jan 28 18:45:32.014 2025 conn 79 (127.0.0.1:55020) */ SELECT * FROM t WHERE MATCH('abcdef') # error=unknown local table(s) 't' in search request
+ /* Tue Jan 28 18:45:32.031 2025 conn 80 (127.0.0.1:55026) */ SELECT * FROM t WHERE MATCH('abcef') OPTION fuzzy=1 # error=unknown local table(s) 't' in search request
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('nonexistent'); SHOW META;"
––– output –––
- +----------------+-------------+
+ ERROR 1064 (42000) at line 1: unknown local table(s) 't' in search request
- | Variable_name | Value |
- +----------------+-------------+
- | total | 0 |
- | total_found | 0 |
- | total_relation | eq |
- | time | #!/[0-9]{1}.[0-9]{3}/!# |
- | keyword[0] | nonexistent |
- | docs[0] | 0 |
- | hits[0] | 0 |
- +----------------+-------------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('abcdef') OPTION fuzzy=1;"
––– output –––
- +------+-----------+
+ ERROR 1064 (42000) at line 1: unknown local table(s) 't' in search request
- | id | f |
- +------+-----------+
- | 1 | abcdef |
- | 2 | abcd efgh |
- +------+-----------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('\$#@\!') OPTION fuzzy=1;"
––– output –––
+ ERROR 1064 (42000) at line 1: unknown local table(s) 't' in search request
––– input –––
mysql -h0 -P9306 -e "DROP TABLE IF EXISTS idx1; CREATE TABLE idx1(value TEXT) min_infix_len='2';"
––– output –––
––– input –––
mysql -h0 -P9306 -e "INSERT INTO idx1(value) VALUES ('340');"
––– output –––
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('34', 'idx1');"
––– output –––
+-------+
| query |
+-------+
| 340 |
+-------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('3', 'idx1');"
––– output –––
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('34', 'idx1', 1 AS fuzziness);"
––– output –––
+-------+
| query |
+-------+
| 340 |
+-------+
––– input –––
echo -e "searchd {\nlisten = 9306:mysql\nlisten = 9312\nlisten = 9308:http\nlog = /tmp/searchd.log\nquery_log = /tmp/query.log\npid_file = /tmp/searchd.pid\n}\n\nsource src_idx {\ntype = tsvpipe\ntsvpipe_command = cat /tmp/data.tsv\ntsvpipe_field_string = f\ntsvpipe_attr_bigint = id\n}\n\nindex idx_plain {\ntype = plain\nsource = src_idx\npath = /tmp/idx_plain\nmin_infix_len = 2\n}" > /tmp/manticore_idx.conf
––– output –––
––– input –––
echo -e "1\tabcdef\n2\tabcd efgh\n3\trandom text" > /tmp/data.tsv
––– output –––
––– input –––
mkdir -p /tmp/idx_plain && chmod 777 /tmp/idx_plain
––– output –––
––– input –––
indexer --all --config /tmp/manticore_idx.conf > /dev/null 2>&1
––– output –––
––– input –––
rm -f /tmp/searchd.log; searchd --stopwait > /dev/null; searchd -c /tmp/manticore_idx.conf; if timeout 10 grep -qm1 '\[BUDDY\] started' <(tail -n 1000 -f /var/log/manticore/searchd.log); then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /var/log/manticore/searchd.log;fi
––– output –––
Manticore %{VERSION} (columnar %{VERSION}) (secondary %{VERSION}) (knn %{VERSION})
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-%{YEAR}, Manticore Software LTD (https://manticoresearch.com)
[#!/[0-9]{2}:[0-9]{2}.[0-9]{3}/!#] [#!/[0-9]+/!#] using config file '/tmp/manticore_idx.conf' (%{NUMBER} chars)...
starting daemon version '%{VERSION} (columnar %{VERSION}) (secondary %{VERSION}) (knn %{VERSION})' ...
listening on all interfaces for mysql, port=9306
listening on all interfaces for sphinx and http(s), port=9312
listening on all interfaces for sphinx and http(s), port=9308
precaching table 'idx_plain'
precached 1 tables in #!/[0-9]{1,2}.[0-9]+/!# sec
Buddy started!
––– input –––
mysql -h0 -P9306 -e "SHOW TABLES;"
––– output –––
+-----------+-------+
| Table | Type |
+-----------+-------+
| idx_plain | local |
+-----------+-------+
––– input –––
mysql -h0 -P9306 -e "SHOW TABLE idx_plain SETTINGS;"
––– output –––
+---------------+-------------------+
| Variable_name | Value |
+---------------+-------------------+
| settings | min_infix_len = 2 |
+---------------+-------------------+
––– input –––
mysql -h0 -P9306 -e "show version\G;"
––– output –––
*************************** 1. row ***************************
Component: Daemon
Version: %{VERSION}
*************************** 2. row ***************************
Component: Columnar
Version: columnar %{VERSION}
*************************** 3. row ***************************
Component: Secondary
Version: secondary %{VERSION}
*************************** 4. row ***************************
Component: KNN
Version: knn %{VERSION}
*************************** 5. row ***************************
Component: Buddy
Version: buddy %{VERSION}
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM idx_plain WHERE MATCH('abcdef') OPTION fuzzy=1;"
––– output –––
+------+-----------+
| id | f |
+------+-----------+
| 1 | abcdef |
| 2 | abcd efgh |
+------+-----------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM idx_plain WHERE MATCH('abcef') OPTION fuzzy=1;"
––– output –––
+------+-----------+
| id | f |
+------+-----------+
| 1 | abcdef |
| 2 | abcd efgh |
+------+-----------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM idx_plain WHERE MATCH('nonexistent') OPTION fuzzy=1;"
––– output –––
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('abc', 'idx_plain');"
––– output –––
+--------+
| query |
+--------+
| abcd |
| abcdef |
+--------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('ran', 'idx_plain');"
––– output –––
+--------+
| query |
+--------+
| random |
+--------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('zzz', 'idx_plain');"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM idx_plain WHERE MATCH('abcdef') OPTION fuzzy=0;"
––– output –––
+------+--------+
| id | f |
+------+--------+
| 1 | abcdef |
+------+--------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM idx_plain WHERE MATCH('abcd efgh') OPTION fuzzy=0;"
––– output –––
+------+-----------+
| id | f |
+------+-----------+
| 2 | abcd efgh |
+------+-----------+
|
clt❌ CLT tests in test/clt-tests/core/test-buddy-requests-not-logged.rec––– input –––
echo -e "searchd {\n listen = 127.0.0.1:9312\n listen = 127.0.0.1:9306:mysql\n listen = 127.0.0.1:9308:http\n log = /var/log/manticore/searchd.log\n query_log = /var/log/manticore/query.log\n pid_file = /var/run/manticore/searchd.pid\n data_dir = /var/lib/manticore\n buddy_path = # disables Manticore Buddy\n}" > nobuddy.conf
––– output –––
––– input –––
cat nobuddy.conf
––– output –––
+ searchd {
+ listen = 127.0.0.1:9312
+ listen = 127.0.0.1:9306:mysql
+ listen = 127.0.0.1:9308:http
+ log = /var/log/manticore/searchd.log
+ query_log = /var/log/manticore/query.log
+ pid_file = /var/run/manticore/searchd.pid
+ data_dir = /var/lib/manticore
+ buddy_path = # disables Manticore Buddy
+ }
––– input –––
rm -f /var/log/manticore/searchd.log; searchd --stopwait > /dev/null; searchd -c nobuddy.conf; if timeout 10 grep -qm1 '\[BUDDY\] started' <(tail -n 1000 -f /var/log/manticore/searchd.log); then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /var/log/manticore/searchd.log;fi
––– output –––
+ Manticore 6.3.9 90dfd9c39@25012818 dev (columnar 2.3.1 0be00ac@25012210) (secondary 2.3.1 0be00ac@25012210) (knn 2.3.1 0be00ac@25012210)
+ Copyright (c) 2001-2016, Andrew Aksyonoff
+ Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
+ Copyright (c) 2017-2024, Manticore Software LTD (https://manticoresearch.com)
+ [44:51.880] [23] using config file '/.clt/nobuddy.conf' (317 chars)...
+ starting daemon version '6.3.9 90dfd9c39@25012818 dev (columnar 2.3.1 0be00ac@25012210) (secondary 2.3.1 0be00ac@25012210) (knn 2.3.1 0be00ac@25012210)' ...
+ listening on 127.0.0.1:9312 for sphinx and http(s)
+ listening on 127.0.0.1:9306 for mysql
+ listening on 127.0.0.1:9308 for sphinx and http(s)
+ Timeout or failed!
+ [Tue Jan 28 18:44:51.883 2025] [25] watchdog: main process 26 forked ok
+ [Tue Jan 28 18:44:51.884 2025] [26] Using local time zone '/etc/localtime'
+ [Tue Jan 28 18:44:51.884 2025] [26] starting daemon version '6.3.9 90dfd9c39@25012818 dev (columnar 2.3.1 0be00ac@25012210) (secondary 2.3.1 0be00ac@25012210) (knn 2.3.1 0be00ac@25012210)' ...
+ [Tue Jan 28 18:44:51.884 2025] [26] listening on 127.0.0.1:9312 for sphinx and http(s)
+ [Tue Jan 28 18:44:51.884 2025] [26] listening on 127.0.0.1:9306 for mysql
+ [Tue Jan 28 18:44:51.884 2025] [26] listening on 127.0.0.1:9308 for sphinx and http(s)
+ [Tue Jan 28 18:44:51.909 2025] [27] prereading 0 tables
+ [Tue Jan 28 18:44:51.909 2025] [27] preread 0 tables in 0.000 sec
+ [Tue Jan 28 18:44:51.909 2025] [26] accepting connections
––– input –––
mysql -h0 -P9306 -e "create table test (id BIGINT, model TEXT);"; echo $?
––– output –––
+ 0
––– input –––
curl -X POST http://localhost:9308/insert -d '{"index":"test","id":1,"doc":{"model":"Test message"}}' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
curl -H 'User-agent: Manticore Buddy/1.0.0' -d 'query=select * from test' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
curl -H 'User-agent: Manticore Buddy/1.0.0' -d 'query=select * from test; show meta' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
grep -i "Manticore Buddy" /var/log/manticore/query.log
––– output –––
––– input –––
grep -E "select \* from test|show meta" /var/log/manticore/query.log
––– output –––
––– input –––
curl -H 'User-agent: Other-Agent/1.0' -d 'query=select * from test' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
grep "Other-Agent" /var/log/manticore/query.log
––– output –––
––– input –––
curl -H 'User-agent: Manticore Buddy/1.0.0' -d 'query=delete from test where id=1' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
grep "delete from test" /var/log/manticore/query.log
––– output –––
––– input –––
curl -H 'User-agent:' -d 'query=select * from test' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
grep -i "User-Agent" /var/log/manticore/query.log
––– output –––
––– input –––
curl -H 'User-agent: Manticore Buddy/1.0.0' -d 'query=select * from non_existent_table' 'localhost:9308/sql?mode=raw' > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
grep "non_existent_table" /var/log/manticore/query.log
––– output –––
––– input –––
rm -f nobuddy.conf
––– output –––
|
@donhardman Updated the test to reflect the comments and changed the test logic. I request final approval to merge. |
Type of Change (select one):
Description of the Change:
Related Issue (provide the link):