Skip to content

call keywords expansion results from ram vs disk chunks #3113

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tomatolog
Copy link
Contributor

to test all CI cases

Copy link

clt

❌ CLT tests in test/clt-tests/buddy/
✅ OK: 6
❌ Failed: 1
⏳ Duration: 107s
👉 Check Action Results for commit ff9b5d1
Failed tests:

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    |
+ | id     | username            | s    |
- +--------+-------------------+------+
+ +--------+---------------------+------+
- | 999973 | KEITH SNOW        | a    |
+ | 998893 | IRWIN SOUTHARD      | a    |
- | 999964 | CANDACE BOOTH     | a    |
+ | 998000 | EDYTH CARLISLE      | a    |
- | 999855 | DOROTHA WISEMAN   | a    |
+ | 997558 | ARTIE SOUTH         | a    |
- | 999723 | SCOTT OLSON       | a    |
+ | 997189 | BETTY SOUTHERN      | a    |
- | 999264 | RUTHANN GREENE    | a    |
+ | 995514 | LAVELLE SOUTHERLAND | a    |
- | 999197 | HEATH MCNAMARA    | a    |
+ | 995220 | EDYTHE DEGUZMAN     | a    |
- | 999127 | MALENA RUTHERFORD | a    |
+ | 995208 | MARLON SOUTHERN     | a    |
- | 999120 | RUTHANNE CARDOSO  | a    |
+ | 994472 | EDYTHE PYLE         | a    |
- | 999013 | HEATHER HAMMOCK   | a    |
+ | 993920 | YANG SOUTH          | a    |
- | 998893 | IRWIN SOUTHARD    | a    |
+ | 993838 | EDYTHE ZENG         | a    |
- | 998526 | SCOTT CARRION     | a    |
+ | 993488 | EDYTH BATTEN        | a    |
- | 998000 | EDYTH CARLISLE    | a    |
+ | 993140 | LYN SOUTHERN        | a    |
- | 997945 | RUTHE SCHENK      | a    |
+ | 992255 | TRENTON SOUTHERN    | a    |
- | 997558 | ARTIE SOUTH       | a    |
+ | 992085 | ASHLYN SOUTH        | a    |
- | 997544 | HEATHER CLAUSEN   | a    |
+ | 991919 | LELAH SOUTHERLAND   | a    |
- | 997189 | BETTY SOUTHERN    | a    |
+ | 989609 | EDYTH NOVAK         | a    |
- | 997187 | SUSAN SCOTT       | a    |
+ | 987549 | EMILIA SOUTH        | a    |
- | 997098 | OTHA FAJARDO      | a    |
+ | 987044 | OFELIA SOUTH        | a    |
- | 997074 | SCOTT FLANDERS    | a    |
+ | 985925 | VENITA SMYTH        | a    |
- | 996804 | SCOTT ENOS        | a    |
+ | 985469 | CECILIA SOUTH       | 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; DEBUG SLEEP 2; CREATE TABLE t(f TEXT) min_infix_len='2';"
––– output –––
+---------+--------+
| command | result |
+---------+--------+
| sleep   | #!/[0-9]{1}.[0-9]{3}/!#  |
+---------+--------+
––– input –––
mysql -h0 -P9306 -e "INSERT INTO t VALUES (1, 'abcdef'), (2, 'abcd efgh');"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('abcdef'); SHOW META;"
––– output –––
+------+--------+
| 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 –––
+------+-----------+
| 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');
/* #!/[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;
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('nonexistent'); SHOW META;"
––– output –––
+----------------+-------------+
| 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 –––
+------+-----------+
| id   | f         |
+------+-----------+
|    1 | abcdef    |
|    2 | abcd efgh |
+------+-----------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('\$#@\!') OPTION fuzzy=1;"
––– output –––
––– 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 |
+------+-----------+

Copy link

clt

❌ CLT tests in test/clt-tests/buddy/
✅ OK: 6
❌ Failed: 1
⏳ Duration: 103s
👉 Check Action Results for commit ff9b5d1
Failed tests:

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    |
+ | id     | username            | s    |
- +--------+-------------------+------+
+ +--------+---------------------+------+
- | 999973 | KEITH SNOW        | a    |
+ | 998893 | IRWIN SOUTHARD      | a    |
- | 999964 | CANDACE BOOTH     | a    |
+ | 998000 | EDYTH CARLISLE      | a    |
- | 999855 | DOROTHA WISEMAN   | a    |
+ | 997558 | ARTIE SOUTH         | a    |
- | 999723 | SCOTT OLSON       | a    |
+ | 997189 | BETTY SOUTHERN      | a    |
- | 999264 | RUTHANN GREENE    | a    |
+ | 995514 | LAVELLE SOUTHERLAND | a    |
- | 999197 | HEATH MCNAMARA    | a    |
+ | 995220 | EDYTHE DEGUZMAN     | a    |
- | 999127 | MALENA RUTHERFORD | a    |
+ | 995208 | MARLON SOUTHERN     | a    |
- | 999120 | RUTHANNE CARDOSO  | a    |
+ | 994472 | EDYTHE PYLE         | a    |
- | 999013 | HEATHER HAMMOCK   | a    |
+ | 993920 | YANG SOUTH          | a    |
- | 998893 | IRWIN SOUTHARD    | a    |
+ | 993838 | EDYTHE ZENG         | a    |
- | 998526 | SCOTT CARRION     | a    |
+ | 993488 | EDYTH BATTEN        | a    |
- | 998000 | EDYTH CARLISLE    | a    |
+ | 993140 | LYN SOUTHERN        | a    |
- | 997945 | RUTHE SCHENK      | a    |
+ | 992255 | TRENTON SOUTHERN    | a    |
- | 997558 | ARTIE SOUTH       | a    |
+ | 992085 | ASHLYN SOUTH        | a    |
- | 997544 | HEATHER CLAUSEN   | a    |
+ | 991919 | LELAH SOUTHERLAND   | a    |
- | 997189 | BETTY SOUTHERN    | a    |
+ | 989609 | EDYTH NOVAK         | a    |
- | 997187 | SUSAN SCOTT       | a    |
+ | 987549 | EMILIA SOUTH        | a    |
- | 997098 | OTHA FAJARDO      | a    |
+ | 987044 | OFELIA SOUTH        | a    |
- | 997074 | SCOTT FLANDERS    | a    |
+ | 985925 | VENITA SMYTH        | a    |
- | 996804 | SCOTT ENOS        | a    |
+ | 985469 | CECILIA SOUTH       | 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; DEBUG SLEEP 2; CREATE TABLE t(f TEXT) min_infix_len='2';"
––– output –––
+---------+--------+
| command | result |
+---------+--------+
| sleep   | #!/[0-9]{1}.[0-9]{3}/!#  |
+---------+--------+
––– input –––
mysql -h0 -P9306 -e "INSERT INTO t VALUES (1, 'abcdef'), (2, 'abcd efgh');"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('abcdef'); SHOW META;"
––– output –––
+------+--------+
| 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 –––
+------+-----------+
| 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');
/* #!/[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;
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('nonexistent'); SHOW META;"
––– output –––
+----------------+-------------+
| 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 –––
+------+-----------+
| id   | f         |
+------+-----------+
|    1 | abcdef    |
|    2 | abcd efgh |
+------+-----------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('\$#@\!') OPTION fuzzy=1;"
––– output –––
––– 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 |
+------+-----------+

Copy link

clt

❌ CLT tests in test/clt-tests/buddy/
✅ OK: 6
❌ Failed: 1
⏳ Duration: 102s
👉 Check Action Results for commit ff9b5d1
Failed tests:

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    |
+ | id     | username            | s    |
- +--------+-------------------+------+
+ +--------+---------------------+------+
- | 999973 | KEITH SNOW        | a    |
+ | 998893 | IRWIN SOUTHARD      | a    |
- | 999964 | CANDACE BOOTH     | a    |
+ | 998000 | EDYTH CARLISLE      | a    |
- | 999855 | DOROTHA WISEMAN   | a    |
+ | 997558 | ARTIE SOUTH         | a    |
- | 999723 | SCOTT OLSON       | a    |
+ | 997189 | BETTY SOUTHERN      | a    |
- | 999264 | RUTHANN GREENE    | a    |
+ | 995514 | LAVELLE SOUTHERLAND | a    |
- | 999197 | HEATH MCNAMARA    | a    |
+ | 995220 | EDYTHE DEGUZMAN     | a    |
- | 999127 | MALENA RUTHERFORD | a    |
+ | 995208 | MARLON SOUTHERN     | a    |
- | 999120 | RUTHANNE CARDOSO  | a    |
+ | 994472 | EDYTHE PYLE         | a    |
- | 999013 | HEATHER HAMMOCK   | a    |
+ | 993920 | YANG SOUTH          | a    |
- | 998893 | IRWIN SOUTHARD    | a    |
+ | 993838 | EDYTHE ZENG         | a    |
- | 998526 | SCOTT CARRION     | a    |
+ | 993488 | EDYTH BATTEN        | a    |
- | 998000 | EDYTH CARLISLE    | a    |
+ | 993140 | LYN SOUTHERN        | a    |
- | 997945 | RUTHE SCHENK      | a    |
+ | 992255 | TRENTON SOUTHERN    | a    |
- | 997558 | ARTIE SOUTH       | a    |
+ | 992085 | ASHLYN SOUTH        | a    |
- | 997544 | HEATHER CLAUSEN   | a    |
+ | 991919 | LELAH SOUTHERLAND   | a    |
- | 997189 | BETTY SOUTHERN    | a    |
+ | 989609 | EDYTH NOVAK         | a    |
- | 997187 | SUSAN SCOTT       | a    |
+ | 987549 | EMILIA SOUTH        | a    |
- | 997098 | OTHA FAJARDO      | a    |
+ | 987044 | OFELIA SOUTH        | a    |
- | 997074 | SCOTT FLANDERS    | a    |
+ | 985925 | VENITA SMYTH        | a    |
- | 996804 | SCOTT ENOS        | a    |
+ | 985469 | CECILIA SOUTH       | 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; DEBUG SLEEP 2; CREATE TABLE t(f TEXT) min_infix_len='2';"
––– output –––
+---------+--------+
| command | result |
+---------+--------+
| sleep   | #!/[0-9]{1}.[0-9]{3}/!#  |
+---------+--------+
––– input –––
mysql -h0 -P9306 -e "INSERT INTO t VALUES (1, 'abcdef'), (2, 'abcd efgh');"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('abcdef'); SHOW META;"
––– output –––
+------+--------+
| 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 –––
+------+-----------+
| 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');
/* #!/[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;
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('nonexistent'); SHOW META;"
––– output –––
+----------------+-------------+
| 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 –––
+------+-----------+
| id   | f         |
+------+-----------+
|    1 | abcdef    |
|    2 | abcd efgh |
+------+-----------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM t WHERE MATCH('\$#@\!') OPTION fuzzy=1;"
––– output –––
––– 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 |
+------+-----------+

Copy link

clt

❌ CLT tests in test/clt-tests/bugs/
✅ OK: 0
❌ Failed: 2
⏳ Duration: 12s
👉 Check Action Results for commit a39ddd1
Failed tests:

test/clt-tests/bugs/489-different-result-with-ramchunk.rec
––– input –––
rm -f /var/log/manticore/searchd.log; stdbuf -oL searchd --stopwait > /dev/null; stdbuf -oL searchd > /dev/null
––– output –––
OK
––– input –––
if timeout 10 grep -qm1 'accepting connections' <(tail -n 1000 -f /var/log/manticore/searchd.log); then echo 'Accepting connections!'; else echo 'Timeout or failed!'; fi
––– output –––
OK
––– input –––
mysql -P9306 -h0 -e "drop table if exists t; create table t(name text) min_infix_len='2' diskchunk_flush_write_timeout = '9999';"
––– output –––
OK
––– input –––
mysql -P9306 -h0 -e "insert into t values(1, 'LIMITED LIABILIYT COMPANY TVK'); insert into t values(2, 'LIPITED LIABILITY COMPANY ABCDEF'); insert into t values(3, 'LIXITED LIABILITY COMPANY XXXXXX');"
––– output –––
OK
––– input –––
mysql -P9306 -h0 -e "call keywords('LI\\?ITED LIQBILITY CO\\?PQNY TVK', 't')"
––– output –––
- | 2    | liqbility | liqbility  |
+ | 1    | li?ited   | li?ited    |
- | 3    | co?pqny   | co?pqny    |
+ | 2    | liqbility | liqbility  |
- | 4    | tvk       | tvk        |
+ | 3    | co?pqny   | co?pqny    |
- +------+-----------+------------+
+ | 4    | tvk       | tvk        |
+ +------+-----------+------------+
––– input –––
mysql -P9306 -h0 -e "flush ramchunk t"
––– output –––
OK
––– input –––
mysql -P9306 -h0 -e "call keywords('LI\\?ITED LIQBILITY CO\\?PQNY TVK', 't')"
––– output –––
- | 1    | li?ited   | lixited    |
+ | 1    | li?ited   | lipited    |
- | 1    | li?ited   | lipited    |
+ | 1    | li?ited   | lixited    |
- | 2    | liqbility | liqbility  |
+ | 1    | li?ited   | li?ited    |
- | 3    | co?pqny   | co?pqny    |
+ | 2    | liqbility | liqbility  |
- | 4    | tvk       | tvk        |
+ | 3    | co?pqny   | co?pqny    |
- +------+-----------+------------+
+ | 4    | tvk       | tvk        |
+ +------+-----------+------------+
test/clt-tests/bugs/3037-secondary-indexes-bug.rec
––– input –––
rm -f /var/log/manticore/searchd.log; stdbuf -oL searchd --stopwait > /dev/null; stdbuf -oL searchd > /dev/null
––– output –––
OK
––– input –––
if timeout 10 grep -qm1 'accepting connections' <(tail -n 1000 -f /var/log/manticore/searchd.log); then echo 'Accepting connections!'; else echo 'Timeout or failed!'; fi
––– output –––
OK
––– input –––
manticore-load --quiet --json --port=9306 --init="CREATE TABLE task (id BIGINT, status UINT, enddatetime TIMESTAMP, isoverdue BOOL)" --load="INSERT INTO task (id, status, enddatetime, isoverdue) VALUES (<increment>, <int/1/8>, <int/1577836800/1672531200>, 0)" --batch-size=1000 --threads=4 --total=10000
––– output –––
- "avg": %{NUMBER}.%{NUMBER},
+ "avg": 5,
––– input –––
mysql -P9306 -h0 -e "FLUSH RAMCHUNK task;"
––– output –––
OK
––– input –––
mysql -P9306 -h0 -e "OPTIMIZE TABLE task OPTION cutoff=1;"
––– output –––
OK
––– input –––
mysql -P9306 -h0 -e "SHOW TABLE task STATUS LIKE 'disk_chunks';"
––– output –––
OK
––– input –––
mysql -P9306 -h0 -e "DESCRIBE task;"
––– output –––
OK
––– input –––
mysql -P9306 -h0 -e "SET GLOBAL secondary_indexes=1; select id,status from task where  isOverdue = 0 and status not in (1,4,5,6,7,8) ORDER BY id ASC LIMIT 10 /*+ SecondaryIndex(status) */; show meta;"
––– output –––
OK
––– input –––
mysql -P9306 -h0 -e "SET GLOBAL secondary_indexes=0; select id,status from task where  isOverdue = 0 and status not in (1,4,5,6,7,8) ORDER BY id ASC LIMIT 10 /*+ SecondaryIndex(status) */; show meta;"
––– output –––
OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants