Skip to content
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

Added new cases to test-fuzzy-search.rec #2900

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

Conversation

PavelShilin89
Copy link
Contributor

Type of Change:

  • Bug fix -

Description of the Change:
Fixed a bug related to executing a query with the fuzzy=1 option on a plain table. Previously, the query returned the following error:

ERROR 1064 (42000): table 'idx' is not real-time or percolate

Related Issue (provide the link):

Copy link

github-actions bot commented Jan 6, 2025

clt

👎 CLT tests in test/clt-tests/buddy/
✅ OK: 2
❌ Failed: 1
⏳ Duration: 94s
👉 Check Action Results for commit 1351e20
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 %{SEMVER} %{COMMITDATE}#!/(\sdev)?\s/!#(columnar %{SEMVER} %{COMMITDATE}) (secondary %{SEMVER} %{COMMITDATE}) (knn %{SEMVER} %{COMMITDATE})
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-%{YEAR}, Manticore Software LTD (https://manticoresearch.com)
[#!/[0-9]{2}:[0-9]{2}.[0-9]{3}/!#] [#!/[0-9]+/!#] using config file '/etc/manticoresearch/manticore.conf' (%{NUMBER} chars)...
starting daemon version '%{SEMVER} %{COMMITDATE}#!/(\sdev)?\s/!#(columnar %{SEMVER} %{COMMITDATE}) (secondary %{SEMVER} %{COMMITDATE}) (knn %{SEMVER} %{COMMITDATE})' ...
listening on %{IPADDR}:9312 for sphinx and http(s)
listening on %{IPADDR}:9306 for mysql
listening on %{IPADDR}:9308 for sphinx and http(s)
Buddy started!
––– input –––
apt-get update -y > /dev/null; echo $?
––– output –––
0
––– input –––
apt-get install jq -y > /dev/null; echo $?
––– output –––
debconf: delaying package configuration, since apt-utils is not installed
0
––– input –––
php -d memory_limit=2G ./test/clt-tests/scripts/load_names_attr.php --batch-size=100000 --concurrency=4 --docs=1000000 --start-id=1 --min-infix-len=2 > /dev/null; echo $?
––– output –––
0
––– input –––
mysql -h0 -P9306 -e "SHOW CREATE TABLE name;" | grep "min_infix_len='2'" | sed "s/.*\(min_infix_len='2'\).*/\1/"
––– output –––
min_infix_len='2'
––– input –––
mysql -h0 -P9306 -e "SELECT COUNT(*) FROM name;"
––– output –––
+----------+
| count(*) |
+----------+
|  1000000 |
+----------+
––– input –––
mysql -h0 -P9306 -e "OPTIMIZE TABLE name OPTION sync=1;"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('RICH') ORDER BY id ASC, username ASC OPTION fuzzy=1;"
––– output –––
+------+-------------------+------+
| id   | username          | s    |
+------+-------------------+------+
|  196 | BRICE MULLIN      | a    |
|  307 | GRICELDA SKELTON  | a    |
|  363 | LAURICE SOLIZ     | a    |
|  478 | ERICH LLAMAS      | a    |
|  490 | LATRICE MANCILLA  | a    |
|  608 | MAURICE PRATHER   | a    |
|  659 | BRICE OLIVARES    | a    |
|  697 | PATRICE WOOD      | a    |
|  822 | JUNITA RICHARD    | a    |
|  835 | AUREA RICO        | a    |
|  854 | ROXANNE BRICE     | a    |
| 1122 | RICH MOLL         | a    |
| 1134 | JOELLA RICHARD    | a    |
| 1160 | MINDY HEINRICH    | a    |
| 1224 | YADIRA RICHARDSON | a    |
| 1379 | BRICE ALLMAN      | a    |
| 1574 | RICO VALENZUELA   | a    |
| 1602 | BEATRICE LOVE     | a    |
| 1822 | RICHELLE ROE      | a    |
| 2136 | CHIQUITA RICHTER  | a    |
+------+-------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('EBGRNA') ORDER BY id ASC, username ASC OPTION fuzzy=1;"
––– output –––
+------+----------------------+------+
| id   | username             | s    |
+------+----------------------+------+
|  675 | CONCEPTION ABERNATHY | a    |
|  964 | BERNARDINA OSHEA     | a    |
| 1354 | VERNA VITALE         | a    |
| 1784 | BERNADETTE HALES     | a    |
| 1839 | BERNARDINA MCMILLAN  | a    |
| 1864 | ERNA ULLOA           | a    |
| 1948 | SAMIRA ABERNATHY     | a    |
| 2238 | JUDI BERNAL          | a    |
| 2446 | MERNA GAITHER        | a    |
| 3065 | BERNADINE HIBBARD    | a    |
| 3195 | BERNADETTE SHELTON   | a    |
| 3688 | VERNA GASTON         | a    |
| 3781 | BERNARDINE WILKINS   | a    |
| 4370 | ERNA VITALE          | a    |
| 4637 | TARSHA HERNANDEZ     | a    |
| 4662 | FERNANDO HOUCK       | a    |
| 5044 | CONSTANCE ABERNATHY  | a    |
| 5580 | LAVERNA GORMAN       | a    |
| 5582 | FERNANDE ISRAEL      | a    |
| 5798 | LAVERNA STORM        | a    |
+------+----------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('ANT') ORDER BY id ASC, username ASC OPTION fuzzy=1;"
––– output –––
+------+-------------------+------+
| id   | username          | s    |
+------+-------------------+------+
|    8 | DAMIAN SOMERS     | a    |
|   16 | TAMI WHELAN       | a    |
|   19 | DARCY SANDBERG    | a    |
|   20 | RANEE BROUGHTON   | a    |
|   21 | STEPHEN ALLMAN    | a    |
|   30 | AMANDA KEY        | a    |
|   37 | ELFRIEDA HANKS    | a    |
|   41 | NANNIE WILLINGHAM | a    |
|   42 | YOULANDA TROUT    | a    |
|   44 | ANTHONY SMOOT     | a    |
|   47 | FRANCIE BUNDY     | a    |
|   51 | LATASHA POLAND    | a    |
|   53 | SHEMEKA DURAND    | a    |
|   54 | LATANYA ARNDT     | a    |
|   56 | JANELLE LASTER    | a    |
|   57 | NANNIE HANNON     | a    |
|   58 | GRANVILLE VALDEZ  | a    |
|   59 | DEDE SPANN        | a    |
|   60 | DANIEL MERRITT    | a    |
|   63 | SAUL HOWLAND      | a    |
+------+-------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('tony') ORDER BY id ASC, username ASC OPTION fuzzy=1;"
––– output –––
+------+--------------------+------+
| id   | username           | s    |
+------+--------------------+------+
|  118 | ANTONIA VANWINKLE  | a    |
|  220 | ANTONIA MELGAR     | a    |
|  391 | KARYL TONEY        | a    |
|  761 | TONYA SHERRILL     | a    |
| 1527 | LEONE TONEY        | a    |
| 2132 | TONIA RAPP         | a    |
| 2195 | TONIE HOANG        | a    |
| 2333 | LATONIA VILLASENOR | a    |
| 2357 | TONIE BARNHILL     | a    |
| 2430 | TONIA BOSTICK      | a    |
| 2584 | TONI SPENCE        | a    |
| 2725 | ANTONIETTA CINTRON | a    |
| 2881 | ANTONINA HASKELL   | a    |
| 3318 | TONY DUPRE         | a    |
| 3582 | ANTONIETTA BAEZ    | a    |
| 3858 | TONEY SCHOEN       | a    |
| 4366 | ROCHEL TONEY       | a    |
| 4608 | ANTONIA DRISCOLL   | a    |
| 4657 | TONYA PARRIS       | a    |
| 4800 | TONY WEISS         | a    |
+------+--------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SMITH') ORDER BY id DESC, username ASC OPTION fuzzy=1;"
––– output –––
+--------+-------------------+------+
| id     | username          | s    |
+--------+-------------------+------+
| 999973 | KEITH SNOW        | a    |
| 999855 | DOROTHA WISEMAN   | a    |
| 999723 | SCOTT OLSON       | a    |
| 999264 | RUTHANN GREENE    | a    |
| 999250 | MINH LANDERS      | a    |
| 999127 | MALENA RUTHERFORD | a    |
| 999120 | RUTHANNE CARDOSO  | a    |
| 998893 | IRWIN SOUTHARD    | a    |
| 998691 | MITCHELL SEITZ    | a    |
| 998539 | ELSA SEITZ        | a    |
| 998526 | SCOTT CARRION     | a    |
| 997945 | RUTHE SCHENK      | a    |
| 997815 | MINH GOODWIN      | a    |
| 997558 | ARTIE SOUTH       | a    |
| 997189 | BETTY SOUTHERN    | a    |
| 997187 | SUSAN SCOTT       | a    |
| 997098 | OTHA FAJARDO      | a    |
| 997074 | SCOTT FLANDERS    | a    |
| 996804 | SCOTT ENOS        | a    |
| 996461 | EDRA HIGGINBOTHAM | a    |
+--------+-------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SMITH') ORDER BY id DESC, username ASC OPTION fuzzy=1;"
––– output –––
+--------+-------------------+------+
| id     | username          | s    |
+--------+-------------------+------+
| 999973 | KEITH SNOW        | a    |
| 999855 | DOROTHA WISEMAN   | a    |
| 999723 | SCOTT OLSON       | a    |
| 999264 | RUTHANN GREENE    | a    |
| 999250 | MINH LANDERS      | a    |
| 999127 | MALENA RUTHERFORD | a    |
| 999120 | RUTHANNE CARDOSO  | a    |
| 998893 | IRWIN SOUTHARD    | a    |
| 998691 | MITCHELL SEITZ    | a    |
| 998539 | ELSA SEITZ        | a    |
| 998526 | SCOTT CARRION     | a    |
| 997945 | RUTHE SCHENK      | a    |
| 997815 | MINH GOODWIN      | a    |
| 997558 | ARTIE SOUTH       | a    |
| 997189 | BETTY SOUTHERN    | a    |
| 997187 | SUSAN SCOTT       | a    |
| 997098 | OTHA FAJARDO      | a    |
| 997074 | SCOTT FLANDERS    | a    |
| 996804 | SCOTT ENOS        | a    |
| 996461 | EDRA HIGGINBOTHAM | a    |
+--------+-------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SMYTH') ORDER BY id DESC, username ASC OPTION fuzzy=1;"
––– output –––
+--------+-------------------+------+
| id     | username          | s    |
+--------+-------------------+------+
| 999973 | KEITH SNOW        | a    |
| 999964 | CANDACE BOOTH     | a    |
| 999855 | DOROTHA WISEMAN   | a    |
| 999723 | SCOTT OLSON       | a    |
| 999264 | RUTHANN GREENE    | a    |
| 999197 | HEATH MCNAMARA    | a    |
| 999127 | MALENA RUTHERFORD | a    |
| 999120 | RUTHANNE CARDOSO  | a    |
| 999013 | HEATHER HAMMOCK   | a    |
| 998893 | IRWIN SOUTHARD    | a    |
| 998526 | SCOTT CARRION     | a    |
| 998000 | EDYTH CARLISLE    | a    |
| 997945 | RUTHE SCHENK      | a    |
| 997558 | ARTIE SOUTH       | a    |
| 997544 | HEATHER CLAUSEN   | a    |
| 997189 | BETTY SOUTHERN    | a    |
| 997187 | SUSAN SCOTT       | a    |
| 997098 | OTHA FAJARDO      | a    |
| 997074 | SCOTT FLANDERS    | a    |
| 996804 | SCOTT ENOS        | a    |
+--------+-------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SMITH') ORDER BY id DESC, username ASC OPTION fuzzy="1";"
––– output –––
+--------+-------------------+------+
| id     | username          | s    |
+--------+-------------------+------+
| 999973 | KEITH SNOW        | a    |
| 999855 | DOROTHA WISEMAN   | a    |
| 999723 | SCOTT OLSON       | a    |
| 999264 | RUTHANN GREENE    | a    |
| 999250 | MINH LANDERS      | a    |
| 999127 | MALENA RUTHERFORD | a    |
| 999120 | RUTHANNE CARDOSO  | a    |
| 998893 | IRWIN SOUTHARD    | a    |
| 998691 | MITCHELL SEITZ    | a    |
| 998539 | ELSA SEITZ        | a    |
| 998526 | SCOTT CARRION     | a    |
| 997945 | RUTHE SCHENK      | a    |
| 997815 | MINH GOODWIN      | a    |
| 997558 | ARTIE SOUTH       | a    |
| 997189 | BETTY SOUTHERN    | a    |
| 997187 | SUSAN SCOTT       | a    |
| 997098 | OTHA FAJARDO      | a    |
| 997074 | SCOTT FLANDERS    | a    |
| 996804 | SCOTT ENOS        | a    |
| 996461 | EDRA HIGGINBOTHAM | a    |
+--------+-------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('john') ORDER BY id DESC, username ASC OPTION fuzzy=1;"
––– output –––
+--------+------------------------+------+
| id     | username               | s    |
+--------+------------------------+------+
| 999961 | JONELL ENRIGHT         | a    |
| 999932 | JONELL NIX             | a    |
| 999926 | JONAH BURNSIDE         | a    |
| 999922 | LAVONNA JONAS          | a    |
| 999860 | JOHNETTA DO            | a    |
| 999552 | JOHNNY CARNES          | a    |
| 999548 | JOHNATHAN PEPPER       | a    |
| 999509 | JOHNATHAN STUBBLEFIELD | a    |
| 999171 | JOHNNY ABRAMS          | a    |
| 999033 | AGNUS STJOHN           | a    |
| 998835 | SCARLETT JONAS         | a    |
| 998798 | JOHNATHON READ         | a    |
| 998467 | JOHNSON JEAN           | a    |
| 998393 | JOHN BACH              | a    |
| 998306 | JOHNNY TAFOYA          | a    |
| 998304 | JONG SAUER             | a    |
| 998303 | JONATHON DUPRE         | a    |
| 998278 | JOHNNIE LOR            | a    |
| 998181 | JONA ELROD             | a    |
| 998154 | JONG YORK              | a    |
+--------+------------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('jane') AND id BETWEEN 10000 AND 20000 ORDER BY username ASC OPTION fuzzy=1;"
––– output –––
+-------+--------------------+------+
| id    | username           | s    |
+-------+--------------------+------+
| 10028 | ANJANETTE PORTILLO | a    |
| 10056 | JANETTE LYNCH      | a    |
| 10629 | LANETTE SWAIN      | a    |
| 10874 | JANESSA MONTEZ     | a    |
| 10977 | RUTHANN LANEY      | a    |
| 11038 | DESIRE LANE        | a    |
| 11056 | LANELLE WATTS      | a    |
| 11397 | MELITA LANE        | a    |
| 11415 | MARYJANE HOLTZ     | a    |
| 11569 | JANETH SELBY       | a    |
| 11758 | JANETTE GANTT      | a    |
| 11834 | JANELLE DRIGGERS   | a    |
| 12100 | JAE COBLE          | a    |
| 12171 | JAE MEARS          | a    |
| 12185 | JANESSA BALTAZAR   | a    |
| 12237 | JANENE APODACA     | a    |
| 12490 | LANELLE ARNDT      | a    |
| 12536 | JANENE WALDRON     | a    |
| 12540 | ANJANETTE STAGGS   | a    |
| 12642 | HERSHEL LANEY      | a    |
+-------+--------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('EBGRNA') AND id BETWEEN 1000 AND 2000 ORDER BY username ASC OPTION fuzzy=1;"
––– output –––
+------+---------------------+------+
| id   | username            | s    |
+------+---------------------+------+
| 1354 | VERNA VITALE        | a    |
| 1784 | BERNADETTE HALES    | a    |
| 1839 | BERNARDINA MCMILLAN | a    |
| 1864 | ERNA ULLOA          | a    |
| 1948 | SAMIRA ABERNATHY    | a    |
+------+---------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SARA') ORDER BY id ASC, username ASC OPTION fuzzy=1;"
––– output –––
+------+------------------+------+
| id   | username         | s    |
+------+------------------+------+
|  188 | LARA KIRK        | a    |
|  207 | CLARA MORRIS     | a    |
|  351 | KLARA DONALDSON  | a    |
|  990 | ELAINE SARABIA   | a    |
| 1409 | LARA FREDERICK   | a    |
| 1661 | SARA GARNER      | a    |
| 1831 | SARAI ESPINAL    | a    |
| 2074 | VALENTIN SARABIA | a    |
| 2930 | LARA CINTRON     | a    |
| 3045 | KLARA ANDRES     | a    |
| 3373 | KLARA NORTON     | a    |
| 3741 | CRUZ SARABIA     | a    |
| 3780 | RUSSEL LARA      | a    |
| 4700 | HEE SARABIA      | a    |
| 4933 | KLARA GOODING    | a    |
| 5830 | SARAI LINDLEY    | a    |
| 5865 | SARAN KNAPP      | a    |
| 5918 | SARA WAITE       | a    |
| 6635 | CLARA BEALE      | a    |
| 6836 | CLARA BAZAN      | a    |
+------+------------------+------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS fuzziness);" | tail -n +4 | sort
––– output –––
+---------+
| joe     |
| john    |
| johnie  |
| johnson |
| jordan  |
| jose    |
| joseph  |
| joshua  |
| joy     |
| joyce   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'us,ru' AS layouts);" | tail -n +4 | sort
––– output –––
+---------+
| joe     |
| john    |
| johnie  |
| johnson |
| jordan  |
| jose    |
| joseph  |
| joshua  |
| joy     |
| joyce   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append);" | tail -n +4 | sort
––– output –––
+---------+
| joe     |
| john    |
| johnie  |
| johnson |
| jordan  |
| jose    |
| joseph  |
| joshua  |
| joy     |
| joyce   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 0 AS prepend);" | tail -n +4 | sort
––– output –––
+---------+
| joe     |
| john    |
| johnson |
| jonas   |
| jordan  |
| jose    |
| joseph  |
| joshua  |
| joy     |
| joyce   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS prepend, 1 AS append);" | tail -n +4 | sort
––– output –––
+---------+
| joe     |
| john    |
| johnie  |
| johnson |
| jordan  |
| jose    |
| joseph  |
| joshua  |
| joy     |
| joyce   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS fuzziness, '' AS layouts, 1 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
+---------+
| joe     |
| john    |
| johnie  |
| johnson |
| jordan  |
| jose    |
| joseph  |
| joshua  |
| joy     |
| joyce   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 2 AS fuzziness, 'us,ru' AS layouts, 1 AS append, 1 AS prepend, 2 AS expansion_len);" | tail -n +4 | sort
––– output –––
+-------+
| joe   |
| john  |
| jose  |
| joy   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append);" | tail -n +4 | sort
––– output –––
+---------+
| joe     |
| john    |
| johnie  |
| johnson |
| jordan  |
| jose    |
| joseph  |
| joshua  |
| joy     |
| joyce   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS prepend);" | tail -n +4 | sort
––– output –––
+---------+
| joe     |
| john    |
| johnie  |
| johnson |
| jordan  |
| jose    |
| joseph  |
| joshua  |
| joy     |
| joyce   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
+---------+
| joe     |
| john    |
| johnie  |
| johnson |
| jordan  |
| jose    |
| joseph  |
| joshua  |
| joy     |
| joyce   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'us' AS layouts);" | tail -n +4 | sort
––– output –––
+---------+
| joe     |
| john    |
| johnie  |
| johnson |
| jordan  |
| jose    |
| joseph  |
| joshua  |
| joy     |
| joyce   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'ru' AS layouts);" | tail -n +4 | sort
––– output –––
+---------+
| joe     |
| john    |
| johnie  |
| johnson |
| jordan  |
| jose    |
| joseph  |
| joshua  |
| joy     |
| joyce   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('al', 'name', 0 AS fuzziness);" | tail -n +4 | sort
––– output –––
+-----------+
| albert    |
| alexander |
| allen     |
| dale      |
| dallas    |
| donald    |
| gale      |
| kendall   |
| marshall  |
| walter    |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('mi', 'name', 0 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
+---------+
| ami     |
| britni  |
| brittni |
| cami    |
| choi    |
| darci   |
| eleni   |
| jami    |
| jani    |
| jeni    |
| joi     |
| kaci    |
| kami    |
| kimi    |
| laci    |
| lani    |
| luci    |
| mancini |
| marci   |
| martini |
| melani  |
| muoi    |
| nanci   |
| neomi   |
| noemi   |
| nohemi  |
| ricci   |
| shani   |
| staci   |
| tammi   |
| toi     |
| tomi    |
| traci   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('ch', 'name', 1 AS fuzziness, 3 AS expansion_len);" | tail -n +4 | sort
––– output –––
+-------+
| chang |
| chi   |
| chong |
| chung |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('зф', 'name', 'us,ru' AS layouts);" | tail -n +4 | sort
––– output –––
+---------+
| page    |
| paige   |
| palma   |
| palmer  |
| paris   |
| parker  |
| pat     |
| patrick |
| paul    |
| paz     |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('зф', 'name', 'us' AS layouts);" | tail -n +4 | sort
––– output –––
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('gr', 'name', 1 AS fuzziness, 'ru' AS layouts, 1 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
+------------+
| grace      |
| gracia     |
| grady      |
| graham     |
| grant      |
| gregg      |
| gregory    |
| griffin    |
| grover     |
| montenegro |
––– input –––
mysql -h0 -P9306 -e "drop table if exists t; create table t(f text) min_infix_len='2'; insert into t values(1, 'something'), (2, 'some thing'); select * from t where match('somethin') option fuzzy=0;"
––– output –––
––– input –––
mysql -h0 -P9306 -e "select * from t where match('somethin') option fuzzy=0;"
––– output –––
––– input –––
mysql -P9306 -h0 -e "drop table if exists t; create table t(f text) min_infix_len='2'; insert into t values(1, 'something'), (2, 'some thing'); call autocomplete('some', 't');"
––– output –––
+-----------+
| query     |
+-----------+
| some      |
| something |
+-----------+
––– input –––
mysql -P9306 -h0 -e "drop table if exists t; create table t(f text) min_infix_len='2'; insert into t values(1, 'something'), (2, 'some thing'); call autocomplete('some', 't');"
––– output –––
+-----------+
| query     |
+-----------+
| some      |
| something |
+-----------+
––– input –––
mysql -h0 -P9306 -e "drop table if exists t; create table t(a int);"
––– output –––
––– input –––
mysql -h0 -P9306 -e "select * from t option fuzzy=1;"
––– output –––
ERROR 1064 (42000) at line 1: The 'fuzzy' option requires a full-text query
––– input –––
mysql -h0 -P9306 -e "drop table if exists comment_28798446; create table comment_28798446(id int, content text) min_infix_len='3';"
––– output –––
––– input –––
mysql -h0 -P9306 -e "insert into comment_28798446 values (1, 'business Manticore interaction'), (2, 'buisness Manticore interation'), (3, 'other text content');"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SELECT id FROM comment_28798446 WHERE MATCH('buisness Manticore interation') OPTION fuzzy = 1, layouts = '';"
––– output –––
+------+
| id   |
+------+
|    1 |
|    2 |
+------+
––– input –––
mysql -h0 -P9306 -e "SELECT id FROM comment_28798446 WHERE MATCH('business Manticore interaction') OPTION fuzzy = 1, layouts = '';"
––– output –––
+------+
| id   |
+------+
|    1 |
|    2 |
+------+
––– input –––
mysql -h0 -P9306 -e "SELECT id FROM comment_28798446 WHERE MATCH('Manticore') OPTION fuzzy = 1, layouts = '';"
––– output –––
+------+
| id   |
+------+
|    1 |
|    2 |
+------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('bus', 'comment_28798446', 'ru,us,ua' AS layouts);"
––– output –––
+----------+
| query    |
+----------+
| business |
+----------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('bus', 'comment_28798446', '' AS layouts);"
––– output –––
+----------+
| query    |
+----------+
| business |
+----------+
––– input –––
mysql -h0 -P9306 -e "DROP TABLE IF EXISTS t; CREATE TABLE t(f TEXT) min_infix_len='2';"
––– output –––
––– 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 idx; CREATE TABLE idx(f TEXT) min_infix_len='2';"
––– output –––
––– input –––
mysql -h0 -P9306 -e "INSERT INTO idx VALUES (1, 'abcdef'), (2, 'abcd efgh'), (3, 'random text');"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SHOW TABLE idx SETTINGS;"
––– output –––
+---------------+-------------------+
| Variable_name | Value             |
+---------------+-------------------+
| settings      | min_infix_len = 2 |
+---------------+-------------------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM idx WHERE MATCH('abcdef') OPTION fuzzy=1;"
––– output –––
+------+-----------+
| id   | f         |
+------+-----------+
|    1 | abcdef    |
|    2 | abcd efgh |
+------+-----------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM idx WHERE MATCH('abcef') OPTION fuzzy=1;"
––– output –––
+------+-----------+
| id   | f         |
+------+-----------+
|    1 | abcdef    |
|    2 | abcd efgh |
+------+-----------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM idx WHERE MATCH('nonexistent') OPTION fuzzy=1;"
––– output –––
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('abc', 'idx');"
––– output –––
+--------+
| query  |
+--------+
| abcd   |
| abcdef |
+--------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('ran', 'idx');"
––– output –––
+--------+
| query  |
+--------+
| random |
+--------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('zzz', 'idx');"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM idx WHERE MATCH('abcdef') OPTION fuzzy=0;"
––– output –––
+------+--------+
| id   | f      |
+------+--------+
|    1 | abcdef |
+------+--------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM idx WHERE MATCH('abcd efgh') OPTION fuzzy=0;"
––– output –––
+------+-----------+
| id   | f         |
+------+-----------+
|    2 | abcd efgh |
+------+-----------+
––– input –––
mysql -h0 -P9306 -e "SHOW META;"
––– output –––
+----------------+-------+
| Variable_name  | Value |
+----------------+-------+
| total          | 0     |
| total_found    | 0     |
| total_relation | eq    |
| time           | 0.000 |
+----------------+-------+

-

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

Successfully merging this pull request may close these issues.

2 participants