Skip to content

Created test-update-with-query-log-min-msec.rec #3210

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

Merged
merged 5 commits into from
Mar 19, 2025

Conversation

PavelShilin89
Copy link
Contributor

Type of Change (select one):

  • Bug fix -

Description of the Change:

  • This PR implements a new CLT-test to test a bug fix where fast UPDATE queries (executing in less than 500 milliseconds) were incorrectly logged to query.log despite setting query_log_min_msec = 500 in the Manticore Search configuration.

Related Issue (provide the link):

Copy link

clt

❌ CLT tests in test/clt-tests/buddy/
✅ OK: 8
❌ Failed: 1
⏳ Duration: 122s
👉 Check Action Results for commit 4470076
Failed tests:

test/clt-tests/buddy/test-fuzzy-search.rec
––– input –––
rm -f /var/log/manticore/searchd.log; stdbuf -oL searchd > /dev/null; 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 –––
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=1 --docs=1000000 --start-id=1 --min-infix-len=2 > /dev/null; echo $?
––– output –––
0
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name ORDER BY id ASC LIMIT 1000000 OPTION max_matches=1000000;" > /tmp/name_data.txt
––– output –––
––– input –––
md5sum /tmp/name_data.txt
––– output –––
1995eec70e60c584bc35ff0688556b94  /tmp/name_data.txt
––– 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'expand_keywords='1' |
––– 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    |
+------+---------------------+------+
|   43 | KOURTNEY RICHARDSON | a    |
|  125 | ELAINA RICHARDSON   | a    |
|  226 | RICHARD ZAMARRIPA   | a    |
|  363 | MAYRA RICO          | a    |
|  840 | RICO MCFADDEN       | a    |
|  855 | RICHARD ALDRIDGE    | a    |
|  934 | VALERY RICH         | a    |
|  948 | REGINE ALDRICH      | a    |
| 1017 | HEE TRICE           | a    |
| 1624 | OLEVIA RICHARDS     | a    |
| 1816 | MAURICE BARCLAY     | a    |
| 2228 | THERESIA RICHARDS   | a    |
| 2670 | JULIANA GRICE       | a    |
| 2918 | GRICELDA WHELAN     | a    |
| 3012 | RICHARD MCCURDY     | a    |
| 3147 | MERRILEE ALDRICH    | a    |
| 3262 | FONDA RICHEY        | a    |
| 3431 | MELANY RICHARD      | a    |
| 3438 | JOVAN ALDRICH       | a    |
| 3517 | BRICE LONGORIA      | 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    |
+------+----------------------+------+
|   20 | BERNARDO DUGGAN      | a    |
|   27 | BERNARDINE BREWER    | a    |
|  209 | KATLYN SERNA         | a    |
| 1292 | LAVERNA CLARK        | a    |
| 1414 | BENNY FERNANDEZ      | a    |
| 1638 | JULENE BERNAL        | a    |
| 2021 | LAVERNA JEFFERSON    | a    |
| 2169 | MERNA ORNELAS        | a    |
| 2471 | BERNADINE SCANLON    | a    |
| 2843 | BERNADINE NAPOLITANO | a    |
| 3177 | FERNANDA FRYER       | a    |
| 3199 | FERNANDO FRANCISCO   | a    |
| 3455 | FERNANDE MERRITT     | a    |
| 3539 | BERNADINE HILLER     | a    |
| 3862 | FERNANDO MACDONALD   | a    |
| 4022 | JOHNSON HERNANDES    | a    |
| 4484 | SYBIL HERNANDES      | a    |
| 5159 | MARTINA BERNARD      | a    |
| 5793 | BERNA TALBOTT        | a    |
| 6506 | FERNANDO FREELAND    | 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    |
+------+--------------------+------+
|    6 | KESHIA RANDAZZO    | a    |
|   12 | TRESA ESCALANTE    | a    |
|   20 | BERNARDO DUGGAN    | a    |
|   31 | DEMETRIA IBANEZ    | a    |
|   32 | PAMELIA SANDLIN    | a    |
|   34 | ANJANETTE MINTON   | a    |
|   40 | ANTONIO RIOS       | a    |
|   62 | ANDRES NATION      | a    |
|   64 | MERI MEDRANO       | a    |
|   65 | JANINA FLANIGAN    | a    |
|   72 | TALISHA SWAN       | a    |
|   75 | JANAY BONNER       | a    |
|   80 | DEMETRIA STANFIELD | a    |
|   81 | RALEIGH SANDBERG   | a    |
|   82 | KRISTIAN MEYER     | a    |
|   83 | JANN HEATH         | a    |
|   87 | RANDEE QUINTERO    | a    |
|   99 | DEAN GUO           | a    |
|  103 | DEAN DEAL          | a    |
|  110 | CONSTANCE REES     | 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    |
+-------+------------------+------+
|   688 | SHERIE STORY     | a    |
|  1422 | TOBY CARO        | a    |
|  1627 | RUPERT STORY     | a    |
|  1721 | JOE TONG         | a    |
|  2154 | TONY GREY        | a    |
|  3759 | TOBY GILCHRIST   | a    |
|  5292 | TONA VALENTIN    | a    |
|  5687 | TONY EASTERLING  | a    |
|  5835 | TOBY ROBERSON    | a    |
|  6281 | TOBY ARAIZA      | a    |
|  6962 | TONA DAVIDSON    | a    |
|  7311 | ANTONY STOVALL   | a    |
|  7475 | TOBY REINHART    | a    |
|  8174 | TONA CARRILLO    | a    |
|  8700 | TONA FLETCHER    | a    |
|  8828 | TONYA CALLAHAN   | a    |
|  9251 | TOBY LANGFORD    | a    |
|  9293 | ZENA STORY       | a    |
|  9619 | TONY WHITTINGTON | a    |
| 10167 | LANA STORY       | 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    |
+--------+-----------------+------+
| 999737 | KEITH STUMP     | a    |
| 999039 | KEITH JAMIESON  | a    |
| 996439 | KEITHA CARBAJAL | a    |
| 995770 | KEITH GONZALES  | a    |
| 990882 | MINH SANTANA    | a    |
| 990643 | KEITH MENDES    | a    |
| 989972 | KEITHA WALTERS  | a    |
| 989954 | GWENN SMYTH     | a    |
| 989444 | KEITH KEATON    | a    |
| 988755 | SHERRON SMYTH   | a    |
| 988366 | LAVONIA SMYTH   | a    |
| 988254 | MAYOLA KEITH    | a    |
| 987106 | KEITH FAULK     | a    |
| 986580 | DARNELL SMYTH   | a    |
| 984012 | KEITH CORONEL   | a    |
| 982759 | MORGAN KEITH    | a    |
| 982421 | KEITH SHIFFLETT | a    |
| 982223 | TELMA KEITH     | a    |
| 982056 | RENITA KEITH    | a    |
| 981115 | KATIE SMYTH     | 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    |
+--------+--------------------+------+
| 999921 | VICKI SOUTHARD     | a    |
| 998829 | EDYTHE VACA        | a    |
| 998500 | SETH PHUNG         | a    |
| 996507 | SETH LYMAN         | a    |
| 995690 | ROBERTO SOUTHARD   | a    |
| 995663 | CHUNG SOUTH        | a    |
| 995119 | EDYTHE JOHN        | a    |
| 993455 | EDYTH ROSADO       | a    |
| 993278 | LAKITA SOUTHARD    | a    |
| 992097 | EDYTH RAGAN        | a    |
| 989954 | GWENN SMYTH        | a    |
| 988936 | LARISA SOUTHERLAND | a    |
| 988823 | SETH WHITTAKER     | a    |
| 988759 | LIEN SOUTHARD      | a    |
| 988755 | SHERRON SMYTH      | a    |
| 988366 | LAVONIA SMYTH      | a    |
| 987165 | TULA SOUTHARD      | a    |
| 987136 | LUANN SOUTHARD     | a    |
| 986847 | JORDAN SOUTHERN    | a    |
| 986711 | MARLIN SOUTHERN    | a    |
+--------+--------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SMITH') ORDER BY id DESC, username ASC OPTION fuzzy=\"1\";"
––– output –––
ERROR 1064 (42000) at line 1: P01: syntax error, unexpected $undefined near '"1"'
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('john') ORDER BY id DESC, username ASC OPTION fuzzy=1;"
––– output –––
+--------+--------------------+------+
| id     | username           | s    |
+--------+--------------------+------+
| 999971 | RONNA JOHNSON      | a    |
| 999879 | CHARLEY STJOHN     | a    |
| 999685 | JOAN KOESTER       | a    |
| 999655 | JOHN WAINWRIGHT    | a    |
| 999555 | JON MOSIER         | a    |
| 999440 | JOHN LEONG         | a    |
| 999170 | JONELLE HARDING    | a    |
| 999075 | JOHNIE DURAN       | a    |
| 999020 | JONAS HASAN        | a    |
| 998802 | RENETTA LITTLEJOHN | a    |
| 998721 | REY JOHNSTON       | a    |
| 998368 | JONIE MILTON       | a    |
| 998367 | LEENA JOHNSTON     | a    |
| 998128 | SHARILYN JOHNSTON  | a    |
| 997788 | JOANNIE HENSON     | a    |
| 997670 | DENNY JONES        | a    |
| 997623 | JOHNETTA DELATORRE | a    |
| 997577 | JONA CORRAL        | a    |
| 997563 | JONE FOLSOM        | a    |
| 997512 | JOAN CALKINS       | 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    |
+-------+----------------------+------+
| 10119 | JANIECE GIBSON       | a    |
| 10159 | JANNA MIXON          | a    |
| 10200 | ELANE LOPES          | a    |
| 10205 | JANETTA ZHOU         | a    |
| 10381 | EULALIA LANE         | a    |
| 10465 | JANIE PAXTON         | a    |
| 10492 | JANINA JOE           | a    |
| 10507 | JANNA EDDY           | a    |
| 10635 | JANESSA GOODIN       | a    |
| 10637 | JACQUELYNN JANKOWSKI | a    |
| 10824 | ALEJANDRINA LAUGHLIN | a    |
| 10831 | CLYDE JANES          | a    |
| 10926 | JANNET GOODEN        | a    |
| 10978 | JANAE KELSO          | a    |
| 11064 | JANETH BOWIE         | a    |
| 11266 | MARIELLE ALEJANDRO   | a    |
| 11342 | JANAE DELAGARZA      | a    |
| 11875 | TYLER LUJAN          | a    |
| 11925 | DINAH JANES          | a    |
| 11997 | JANETH BROWNING      | 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    |
+------+-----------------+------+
| 1292 | LAVERNA CLARK   | a    |
| 1414 | BENNY FERNANDEZ | a    |
| 1638 | JULENE BERNAL   | 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    |
+------+----------------------+------+
|   73 | CLARA NGUYEN         | a    |
| 1285 | CLARA CARTAGENA      | a    |
| 1515 | KLARA ALARCON        | a    |
| 1709 | FREDDA LARA          | a    |
| 2217 | LORIANN DELROSARIO   | a    |
| 2305 | SARA AVILA           | a    |
| 2631 | ROSARIA DELONG       | a    |
| 3245 | LARA MASTERSON       | a    |
| 3267 | LARA MOREAU          | a    |
| 3553 | SARAN CHANG          | a    |
| 3880 | SARAN HOOK           | a    |
| 3980 | GEORGETTA DELROSARIO | a    |
| 4517 | SARAI EASLEY         | a    |
| 5708 | ASA ROSARIO          | a    |
| 5731 | SARITA ANDERS        | a    |
| 6100 | CHANTELL SARABIA     | a    |
| 6165 | SARA HALLMAN         | a    |
| 6480 | SARAH NEILL          | a    |
| 6488 | SARAN PARTIN         | a    |
| 6802 | KLARA ROLLER         | a    |
+------+----------------------+------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS fuzziness);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'us,ru' AS layouts);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 0 AS prepend);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| johnny |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS prepend, 1 AS append);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– 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    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– 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   |
| joey  |
| john  |
| jon   |
| jose  |
| joy   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS prepend);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'us' AS layouts);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'ru' AS layouts);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('al', 'name', 0 AS fuzziness);" | tail -n +4 | sort
––– output –––
+-----------+
| albert    |
| alexander |
| ali       |
| dale      |
| gale      |
| kendall   |
| marshall  |
| palma     |
| valentine |
| walter    |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('mi', 'name', 0 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
~ +----------+
~ | britncami   |
~ | brittanidarci  |
~ | cami  joan   |
~ | choi  jody   |
~ | darcijoe    |
~ | jenni oel   |
~ | joi   ey   |
~ | kaci  john   |
~ | kami    johnie |
~ | kimi    johnny |
~ | laci joi    |
~ | leilanijon    |
~ | luci   jonas  |
~ | mancini jordan |
~ | marci  jorge  |
~ | mi    jose   |
~ | muoi    joseph |
~ | nanci  joshi  |
~ | naomi   joshua |
~ | neomijoy    |
~ | nohemi joyce  |
~ | penni kaci   |
~ | ricci kami   |
~ | roni  kimi   |
~ | shani laci   |
~ | staci luci   |
~ | stefanmarci  |
~ | tami     |
~ | tammi  nanci  |
~ | tiffannaomi  |
~ | toi    neomi  |
~ | tomi    nohemi |
~ | traci  ricci  |
+ | staci  |
+ | tami   |
+ | tammi  |
+ | tobias |
+ | todd   |
+ | toi    |
+ | tom    |
+ | tomas  |
+ | tomi   |
+ | toney  |
+ | traci  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('ch', 'name', 1 AS fuzziness, 3 AS expansion_len);" | tail -n +4 | sort
––– output –––
+-------+
| chang |
| chong |
| chung |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('зф', 'name', 'us,ru' AS layouts);" | tail -n +4 | sort
––– output –––
+----------+
| page     |
| paige    |
| palma    |
| paris    |
| parker   |
| pat      |
| patricia |
| 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 |
| grey    |
| grogan  |
| grover  |
––– 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'; 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';"; echo $?
––– output –––
0
––– input –––
mysql -h0 -P9306 -e "INSERT INTO idx1(value) VALUES ('340');"; echo $?
––– output –––
0
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('34', 'idx1');"
––– output –––
+-------+
| query |
+-------+
| 340   |
+-------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('3', 'idx1');"; echo $?
––– output –––
0
––– 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; echo $?
––– output –––
0
––– input –––
echo -e "1\tabcdef\n2\tabcd efgh\n3\trandom text" > /tmp/data.tsv; echo $?
––– output –––
0
––– input –––
mkdir -p /tmp/idx_plain && chmod 777 /tmp/idx_plain; echo $?
––– output –––
0
––– input –––
indexer --all --config /tmp/manticore_idx.conf > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
rm -f /tmp/searchd.log; stdbuf -oL searchd --stopwait > /dev/null; (stdbuf -oL searchd -c /tmp/manticore_idx.conf 2>&1 | tee /tmp/searchd.log | grep -i precach & disown); sleep 0.5; if timeout 10 grep -qm1 '\[BUDDY\] started' /tmp/searchd.log; then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /tmp/searchd.log; fi
––– output –––
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 "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');"; echo $?
––– output –––
0
––– 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: 8
❌ Failed: 1
⏳ Duration: 126s
👉 Check Action Results for commit 4470076
Failed tests:

test/clt-tests/buddy/test-fuzzy-search.rec
––– input –––
rm -f /var/log/manticore/searchd.log; stdbuf -oL searchd > /dev/null; 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 –––
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=1 --docs=1000000 --start-id=1 --min-infix-len=2 > /dev/null; echo $?
––– output –––
0
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name ORDER BY id ASC LIMIT 1000000 OPTION max_matches=1000000;" > /tmp/name_data.txt
––– output –––
––– input –––
md5sum /tmp/name_data.txt
––– output –––
1995eec70e60c584bc35ff0688556b94  /tmp/name_data.txt
––– 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'expand_keywords='1' |
––– 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    |
+------+---------------------+------+
|   43 | KOURTNEY RICHARDSON | a    |
|  125 | ELAINA RICHARDSON   | a    |
|  226 | RICHARD ZAMARRIPA   | a    |
|  363 | MAYRA RICO          | a    |
|  840 | RICO MCFADDEN       | a    |
|  855 | RICHARD ALDRIDGE    | a    |
|  934 | VALERY RICH         | a    |
|  948 | REGINE ALDRICH      | a    |
| 1017 | HEE TRICE           | a    |
| 1624 | OLEVIA RICHARDS     | a    |
| 1816 | MAURICE BARCLAY     | a    |
| 2228 | THERESIA RICHARDS   | a    |
| 2670 | JULIANA GRICE       | a    |
| 2918 | GRICELDA WHELAN     | a    |
| 3012 | RICHARD MCCURDY     | a    |
| 3147 | MERRILEE ALDRICH    | a    |
| 3262 | FONDA RICHEY        | a    |
| 3431 | MELANY RICHARD      | a    |
| 3438 | JOVAN ALDRICH       | a    |
| 3517 | BRICE LONGORIA      | 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    |
+------+----------------------+------+
|   20 | BERNARDO DUGGAN      | a    |
|   27 | BERNARDINE BREWER    | a    |
|  209 | KATLYN SERNA         | a    |
| 1292 | LAVERNA CLARK        | a    |
| 1414 | BENNY FERNANDEZ      | a    |
| 1638 | JULENE BERNAL        | a    |
| 2021 | LAVERNA JEFFERSON    | a    |
| 2169 | MERNA ORNELAS        | a    |
| 2471 | BERNADINE SCANLON    | a    |
| 2843 | BERNADINE NAPOLITANO | a    |
| 3177 | FERNANDA FRYER       | a    |
| 3199 | FERNANDO FRANCISCO   | a    |
| 3455 | FERNANDE MERRITT     | a    |
| 3539 | BERNADINE HILLER     | a    |
| 3862 | FERNANDO MACDONALD   | a    |
| 4022 | JOHNSON HERNANDES    | a    |
| 4484 | SYBIL HERNANDES      | a    |
| 5159 | MARTINA BERNARD      | a    |
| 5793 | BERNA TALBOTT        | a    |
| 6506 | FERNANDO FREELAND    | 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    |
+------+--------------------+------+
|    6 | KESHIA RANDAZZO    | a    |
|   12 | TRESA ESCALANTE    | a    |
|   20 | BERNARDO DUGGAN    | a    |
|   31 | DEMETRIA IBANEZ    | a    |
|   32 | PAMELIA SANDLIN    | a    |
|   34 | ANJANETTE MINTON   | a    |
|   40 | ANTONIO RIOS       | a    |
|   62 | ANDRES NATION      | a    |
|   64 | MERI MEDRANO       | a    |
|   65 | JANINA FLANIGAN    | a    |
|   72 | TALISHA SWAN       | a    |
|   75 | JANAY BONNER       | a    |
|   80 | DEMETRIA STANFIELD | a    |
|   81 | RALEIGH SANDBERG   | a    |
|   82 | KRISTIAN MEYER     | a    |
|   83 | JANN HEATH         | a    |
|   87 | RANDEE QUINTERO    | a    |
|   99 | DEAN GUO           | a    |
|  103 | DEAN DEAL          | a    |
|  110 | CONSTANCE REES     | 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    |
+-------+------------------+------+
|   688 | SHERIE STORY     | a    |
|  1422 | TOBY CARO        | a    |
|  1627 | RUPERT STORY     | a    |
|  1721 | JOE TONG         | a    |
|  2154 | TONY GREY        | a    |
|  3759 | TOBY GILCHRIST   | a    |
|  5292 | TONA VALENTIN    | a    |
|  5687 | TONY EASTERLING  | a    |
|  5835 | TOBY ROBERSON    | a    |
|  6281 | TOBY ARAIZA      | a    |
|  6962 | TONA DAVIDSON    | a    |
|  7311 | ANTONY STOVALL   | a    |
|  7475 | TOBY REINHART    | a    |
|  8174 | TONA CARRILLO    | a    |
|  8700 | TONA FLETCHER    | a    |
|  8828 | TONYA CALLAHAN   | a    |
|  9251 | TOBY LANGFORD    | a    |
|  9293 | ZENA STORY       | a    |
|  9619 | TONY WHITTINGTON | a    |
| 10167 | LANA STORY       | 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    |
+--------+-----------------+------+
| 999737 | KEITH STUMP     | a    |
| 999039 | KEITH JAMIESON  | a    |
| 996439 | KEITHA CARBAJAL | a    |
| 995770 | KEITH GONZALES  | a    |
| 990882 | MINH SANTANA    | a    |
| 990643 | KEITH MENDES    | a    |
| 989972 | KEITHA WALTERS  | a    |
| 989954 | GWENN SMYTH     | a    |
| 989444 | KEITH KEATON    | a    |
| 988755 | SHERRON SMYTH   | a    |
| 988366 | LAVONIA SMYTH   | a    |
| 988254 | MAYOLA KEITH    | a    |
| 987106 | KEITH FAULK     | a    |
| 986580 | DARNELL SMYTH   | a    |
| 984012 | KEITH CORONEL   | a    |
| 982759 | MORGAN KEITH    | a    |
| 982421 | KEITH SHIFFLETT | a    |
| 982223 | TELMA KEITH     | a    |
| 982056 | RENITA KEITH    | a    |
| 981115 | KATIE SMYTH     | 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    |
+--------+--------------------+------+
| 999921 | VICKI SOUTHARD     | a    |
| 998829 | EDYTHE VACA        | a    |
| 998500 | SETH PHUNG         | a    |
| 996507 | SETH LYMAN         | a    |
| 995690 | ROBERTO SOUTHARD   | a    |
| 995663 | CHUNG SOUTH        | a    |
| 995119 | EDYTHE JOHN        | a    |
| 993455 | EDYTH ROSADO       | a    |
| 993278 | LAKITA SOUTHARD    | a    |
| 992097 | EDYTH RAGAN        | a    |
| 989954 | GWENN SMYTH        | a    |
| 988936 | LARISA SOUTHERLAND | a    |
| 988823 | SETH WHITTAKER     | a    |
| 988759 | LIEN SOUTHARD      | a    |
| 988755 | SHERRON SMYTH      | a    |
| 988366 | LAVONIA SMYTH      | a    |
| 987165 | TULA SOUTHARD      | a    |
| 987136 | LUANN SOUTHARD     | a    |
| 986847 | JORDAN SOUTHERN    | a    |
| 986711 | MARLIN SOUTHERN    | a    |
+--------+--------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SMITH') ORDER BY id DESC, username ASC OPTION fuzzy=\"1\";"
––– output –––
ERROR 1064 (42000) at line 1: P01: syntax error, unexpected $undefined near '"1"'
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('john') ORDER BY id DESC, username ASC OPTION fuzzy=1;"
––– output –––
+--------+--------------------+------+
| id     | username           | s    |
+--------+--------------------+------+
| 999971 | RONNA JOHNSON      | a    |
| 999879 | CHARLEY STJOHN     | a    |
| 999685 | JOAN KOESTER       | a    |
| 999655 | JOHN WAINWRIGHT    | a    |
| 999555 | JON MOSIER         | a    |
| 999440 | JOHN LEONG         | a    |
| 999170 | JONELLE HARDING    | a    |
| 999075 | JOHNIE DURAN       | a    |
| 999020 | JONAS HASAN        | a    |
| 998802 | RENETTA LITTLEJOHN | a    |
| 998721 | REY JOHNSTON       | a    |
| 998368 | JONIE MILTON       | a    |
| 998367 | LEENA JOHNSTON     | a    |
| 998128 | SHARILYN JOHNSTON  | a    |
| 997788 | JOANNIE HENSON     | a    |
| 997670 | DENNY JONES        | a    |
| 997623 | JOHNETTA DELATORRE | a    |
| 997577 | JONA CORRAL        | a    |
| 997563 | JONE FOLSOM        | a    |
| 997512 | JOAN CALKINS       | 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    |
+-------+----------------------+------+
| 10119 | JANIECE GIBSON       | a    |
| 10159 | JANNA MIXON          | a    |
| 10200 | ELANE LOPES          | a    |
| 10205 | JANETTA ZHOU         | a    |
| 10381 | EULALIA LANE         | a    |
| 10465 | JANIE PAXTON         | a    |
| 10492 | JANINA JOE           | a    |
| 10507 | JANNA EDDY           | a    |
| 10635 | JANESSA GOODIN       | a    |
| 10637 | JACQUELYNN JANKOWSKI | a    |
| 10824 | ALEJANDRINA LAUGHLIN | a    |
| 10831 | CLYDE JANES          | a    |
| 10926 | JANNET GOODEN        | a    |
| 10978 | JANAE KELSO          | a    |
| 11064 | JANETH BOWIE         | a    |
| 11266 | MARIELLE ALEJANDRO   | a    |
| 11342 | JANAE DELAGARZA      | a    |
| 11875 | TYLER LUJAN          | a    |
| 11925 | DINAH JANES          | a    |
| 11997 | JANETH BROWNING      | 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    |
+------+-----------------+------+
| 1292 | LAVERNA CLARK   | a    |
| 1414 | BENNY FERNANDEZ | a    |
| 1638 | JULENE BERNAL   | 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    |
+------+----------------------+------+
|   73 | CLARA NGUYEN         | a    |
| 1285 | CLARA CARTAGENA      | a    |
| 1515 | KLARA ALARCON        | a    |
| 1709 | FREDDA LARA          | a    |
| 2217 | LORIANN DELROSARIO   | a    |
| 2305 | SARA AVILA           | a    |
| 2631 | ROSARIA DELONG       | a    |
| 3245 | LARA MASTERSON       | a    |
| 3267 | LARA MOREAU          | a    |
| 3553 | SARAN CHANG          | a    |
| 3880 | SARAN HOOK           | a    |
| 3980 | GEORGETTA DELROSARIO | a    |
| 4517 | SARAI EASLEY         | a    |
| 5708 | ASA ROSARIO          | a    |
| 5731 | SARITA ANDERS        | a    |
| 6100 | CHANTELL SARABIA     | a    |
| 6165 | SARA HALLMAN         | a    |
| 6480 | SARAH NEILL          | a    |
| 6488 | SARAN PARTIN         | a    |
| 6802 | KLARA ROLLER         | a    |
+------+----------------------+------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS fuzziness);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'us,ru' AS layouts);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 0 AS prepend);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| johnny |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS prepend, 1 AS append);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– 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    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– 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   |
| joey  |
| john  |
| jon   |
| jose  |
| joy   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS prepend);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'us' AS layouts);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'ru' AS layouts);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('al', 'name', 0 AS fuzziness);" | tail -n +4 | sort
––– output –––
+-----------+
| albert    |
| alexander |
| ali       |
| dale      |
| gale      |
| kendall   |
| marshall  |
| palma     |
| valentine |
| walter    |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('mi', 'name', 0 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
~ +----------+
~ | britncami   |
~ | brittanidarci  |
~ | cami  joan   |
~ | choi  jody   |
~ | darcijoe    |
~ | jenni oel   |
~ | joi   ey   |
~ | kaci  john   |
~ | kami    johnie |
~ | kimi    johnny |
~ | laci joi    |
~ | leilanijon    |
~ | luci   jonas  |
~ | mancini jordan |
~ | marci  jorge  |
~ | mi    jose   |
~ | muoi    joseph |
~ | nanci  joshi  |
~ | naomi   joshua |
~ | neomijoy    |
~ | nohemi joyce  |
~ | penni kaci   |
~ | ricci kami   |
~ | roni  kimi   |
~ | shani laci   |
~ | staci luci   |
~ | stefanmarci  |
~ | tami     |
~ | tammi  nanci  |
~ | tiffannaomi  |
~ | toi    neomi  |
~ | tomi    nohemi |
~ | traci  ricci  |
+ | staci  |
+ | tami   |
+ | tammi  |
+ | tobias |
+ | todd   |
+ | toi    |
+ | tom    |
+ | tomas  |
+ | tomi   |
+ | toney  |
+ | traci  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('ch', 'name', 1 AS fuzziness, 3 AS expansion_len);" | tail -n +4 | sort
––– output –––
+-------+
| chang |
| chong |
| chung |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('зф', 'name', 'us,ru' AS layouts);" | tail -n +4 | sort
––– output –––
+----------+
| page     |
| paige    |
| palma    |
| paris    |
| parker   |
| pat      |
| patricia |
| 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 |
| grey    |
| grogan  |
| grover  |
––– 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'; 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';"; echo $?
––– output –––
0
––– input –––
mysql -h0 -P9306 -e "INSERT INTO idx1(value) VALUES ('340');"; echo $?
––– output –––
0
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('34', 'idx1');"
––– output –––
+-------+
| query |
+-------+
| 340   |
+-------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('3', 'idx1');"; echo $?
––– output –––
0
––– 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; echo $?
––– output –––
0
––– input –––
echo -e "1\tabcdef\n2\tabcd efgh\n3\trandom text" > /tmp/data.tsv; echo $?
––– output –––
0
––– input –––
mkdir -p /tmp/idx_plain && chmod 777 /tmp/idx_plain; echo $?
––– output –––
0
––– input –––
indexer --all --config /tmp/manticore_idx.conf > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
rm -f /tmp/searchd.log; stdbuf -oL searchd --stopwait > /dev/null; (stdbuf -oL searchd -c /tmp/manticore_idx.conf 2>&1 | tee /tmp/searchd.log | grep -i precach & disown); sleep 0.5; if timeout 10 grep -qm1 '\[BUDDY\] started' /tmp/searchd.log; then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /tmp/searchd.log; fi
––– output –––
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 "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');"; echo $?
––– output –––
0
––– 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: 8
❌ Failed: 1
⏳ Duration: 117s
👉 Check Action Results for commit 9399f99
Failed tests:

test/clt-tests/buddy/test-fuzzy-search.rec
––– input –––
rm -f /var/log/manticore/searchd.log; stdbuf -oL searchd > /dev/null; 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 –––
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=1 --docs=1000000 --start-id=1 --min-infix-len=2 > /dev/null; echo $?
––– output –––
0
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name ORDER BY id ASC LIMIT 1000000 OPTION max_matches=1000000;" > /tmp/name_data.txt
––– output –––
––– input –––
md5sum /tmp/name_data.txt
––– output –––
1995eec70e60c584bc35ff0688556b94  /tmp/name_data.txt
––– 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'expand_keywords='1' |
––– 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    |
+------+---------------------+------+
|   43 | KOURTNEY RICHARDSON | a    |
|  125 | ELAINA RICHARDSON   | a    |
|  226 | RICHARD ZAMARRIPA   | a    |
|  363 | MAYRA RICO          | a    |
|  840 | RICO MCFADDEN       | a    |
|  855 | RICHARD ALDRIDGE    | a    |
|  934 | VALERY RICH         | a    |
|  948 | REGINE ALDRICH      | a    |
| 1017 | HEE TRICE           | a    |
| 1624 | OLEVIA RICHARDS     | a    |
| 1816 | MAURICE BARCLAY     | a    |
| 2228 | THERESIA RICHARDS   | a    |
| 2670 | JULIANA GRICE       | a    |
| 2918 | GRICELDA WHELAN     | a    |
| 3012 | RICHARD MCCURDY     | a    |
| 3147 | MERRILEE ALDRICH    | a    |
| 3262 | FONDA RICHEY        | a    |
| 3431 | MELANY RICHARD      | a    |
| 3438 | JOVAN ALDRICH       | a    |
| 3517 | BRICE LONGORIA      | 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    |
+------+----------------------+------+
|   20 | BERNARDO DUGGAN      | a    |
|   27 | BERNARDINE BREWER    | a    |
|  209 | KATLYN SERNA         | a    |
| 1292 | LAVERNA CLARK        | a    |
| 1414 | BENNY FERNANDEZ      | a    |
| 1638 | JULENE BERNAL        | a    |
| 2021 | LAVERNA JEFFERSON    | a    |
| 2169 | MERNA ORNELAS        | a    |
| 2471 | BERNADINE SCANLON    | a    |
| 2843 | BERNADINE NAPOLITANO | a    |
| 3177 | FERNANDA FRYER       | a    |
| 3199 | FERNANDO FRANCISCO   | a    |
| 3455 | FERNANDE MERRITT     | a    |
| 3539 | BERNADINE HILLER     | a    |
| 3862 | FERNANDO MACDONALD   | a    |
| 4022 | JOHNSON HERNANDES    | a    |
| 4484 | SYBIL HERNANDES      | a    |
| 5159 | MARTINA BERNARD      | a    |
| 5793 | BERNA TALBOTT        | a    |
| 6506 | FERNANDO FREELAND    | 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    |
+------+--------------------+------+
|    6 | KESHIA RANDAZZO    | a    |
|   12 | TRESA ESCALANTE    | a    |
|   20 | BERNARDO DUGGAN    | a    |
|   31 | DEMETRIA IBANEZ    | a    |
|   32 | PAMELIA SANDLIN    | a    |
|   34 | ANJANETTE MINTON   | a    |
|   40 | ANTONIO RIOS       | a    |
|   62 | ANDRES NATION      | a    |
|   64 | MERI MEDRANO       | a    |
|   65 | JANINA FLANIGAN    | a    |
|   72 | TALISHA SWAN       | a    |
|   75 | JANAY BONNER       | a    |
|   80 | DEMETRIA STANFIELD | a    |
|   81 | RALEIGH SANDBERG   | a    |
|   82 | KRISTIAN MEYER     | a    |
|   83 | JANN HEATH         | a    |
|   87 | RANDEE QUINTERO    | a    |
|   99 | DEAN GUO           | a    |
|  103 | DEAN DEAL          | a    |
|  110 | CONSTANCE REES     | 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    |
+-------+------------------+------+
|   688 | SHERIE STORY     | a    |
|  1422 | TOBY CARO        | a    |
|  1627 | RUPERT STORY     | a    |
|  1721 | JOE TONG         | a    |
|  2154 | TONY GREY        | a    |
|  3759 | TOBY GILCHRIST   | a    |
|  5292 | TONA VALENTIN    | a    |
|  5687 | TONY EASTERLING  | a    |
|  5835 | TOBY ROBERSON    | a    |
|  6281 | TOBY ARAIZA      | a    |
|  6962 | TONA DAVIDSON    | a    |
|  7311 | ANTONY STOVALL   | a    |
|  7475 | TOBY REINHART    | a    |
|  8174 | TONA CARRILLO    | a    |
|  8700 | TONA FLETCHER    | a    |
|  8828 | TONYA CALLAHAN   | a    |
|  9251 | TOBY LANGFORD    | a    |
|  9293 | ZENA STORY       | a    |
|  9619 | TONY WHITTINGTON | a    |
| 10167 | LANA STORY       | 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    |
+--------+-----------------+------+
| 999737 | KEITH STUMP     | a    |
| 999039 | KEITH JAMIESON  | a    |
| 996439 | KEITHA CARBAJAL | a    |
| 995770 | KEITH GONZALES  | a    |
| 990882 | MINH SANTANA    | a    |
| 990643 | KEITH MENDES    | a    |
| 989972 | KEITHA WALTERS  | a    |
| 989954 | GWENN SMYTH     | a    |
| 989444 | KEITH KEATON    | a    |
| 988755 | SHERRON SMYTH   | a    |
| 988366 | LAVONIA SMYTH   | a    |
| 988254 | MAYOLA KEITH    | a    |
| 987106 | KEITH FAULK     | a    |
| 986580 | DARNELL SMYTH   | a    |
| 984012 | KEITH CORONEL   | a    |
| 982759 | MORGAN KEITH    | a    |
| 982421 | KEITH SHIFFLETT | a    |
| 982223 | TELMA KEITH     | a    |
| 982056 | RENITA KEITH    | a    |
| 981115 | KATIE SMYTH     | 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    |
+--------+--------------------+------+
| 999921 | VICKI SOUTHARD     | a    |
| 998829 | EDYTHE VACA        | a    |
| 998500 | SETH PHUNG         | a    |
| 996507 | SETH LYMAN         | a    |
| 995690 | ROBERTO SOUTHARD   | a    |
| 995663 | CHUNG SOUTH        | a    |
| 995119 | EDYTHE JOHN        | a    |
| 993455 | EDYTH ROSADO       | a    |
| 993278 | LAKITA SOUTHARD    | a    |
| 992097 | EDYTH RAGAN        | a    |
| 989954 | GWENN SMYTH        | a    |
| 988936 | LARISA SOUTHERLAND | a    |
| 988823 | SETH WHITTAKER     | a    |
| 988759 | LIEN SOUTHARD      | a    |
| 988755 | SHERRON SMYTH      | a    |
| 988366 | LAVONIA SMYTH      | a    |
| 987165 | TULA SOUTHARD      | a    |
| 987136 | LUANN SOUTHARD     | a    |
| 986847 | JORDAN SOUTHERN    | a    |
| 986711 | MARLIN SOUTHERN    | a    |
+--------+--------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('SMITH') ORDER BY id DESC, username ASC OPTION fuzzy=\"1\";"
––– output –––
ERROR 1064 (42000) at line 1: P01: syntax error, unexpected $undefined near '"1"'
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM name WHERE MATCH('john') ORDER BY id DESC, username ASC OPTION fuzzy=1;"
––– output –––
+--------+--------------------+------+
| id     | username           | s    |
+--------+--------------------+------+
| 999971 | RONNA JOHNSON      | a    |
| 999879 | CHARLEY STJOHN     | a    |
| 999685 | JOAN KOESTER       | a    |
| 999655 | JOHN WAINWRIGHT    | a    |
| 999555 | JON MOSIER         | a    |
| 999440 | JOHN LEONG         | a    |
| 999170 | JONELLE HARDING    | a    |
| 999075 | JOHNIE DURAN       | a    |
| 999020 | JONAS HASAN        | a    |
| 998802 | RENETTA LITTLEJOHN | a    |
| 998721 | REY JOHNSTON       | a    |
| 998368 | JONIE MILTON       | a    |
| 998367 | LEENA JOHNSTON     | a    |
| 998128 | SHARILYN JOHNSTON  | a    |
| 997788 | JOANNIE HENSON     | a    |
| 997670 | DENNY JONES        | a    |
| 997623 | JOHNETTA DELATORRE | a    |
| 997577 | JONA CORRAL        | a    |
| 997563 | JONE FOLSOM        | a    |
| 997512 | JOAN CALKINS       | 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    |
+-------+----------------------+------+
| 10119 | JANIECE GIBSON       | a    |
| 10159 | JANNA MIXON          | a    |
| 10200 | ELANE LOPES          | a    |
| 10205 | JANETTA ZHOU         | a    |
| 10381 | EULALIA LANE         | a    |
| 10465 | JANIE PAXTON         | a    |
| 10492 | JANINA JOE           | a    |
| 10507 | JANNA EDDY           | a    |
| 10635 | JANESSA GOODIN       | a    |
| 10637 | JACQUELYNN JANKOWSKI | a    |
| 10824 | ALEJANDRINA LAUGHLIN | a    |
| 10831 | CLYDE JANES          | a    |
| 10926 | JANNET GOODEN        | a    |
| 10978 | JANAE KELSO          | a    |
| 11064 | JANETH BOWIE         | a    |
| 11266 | MARIELLE ALEJANDRO   | a    |
| 11342 | JANAE DELAGARZA      | a    |
| 11875 | TYLER LUJAN          | a    |
| 11925 | DINAH JANES          | a    |
| 11997 | JANETH BROWNING      | 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    |
+------+-----------------+------+
| 1292 | LAVERNA CLARK   | a    |
| 1414 | BENNY FERNANDEZ | a    |
| 1638 | JULENE BERNAL   | 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    |
+------+----------------------+------+
|   73 | CLARA NGUYEN         | a    |
| 1285 | CLARA CARTAGENA      | a    |
| 1515 | KLARA ALARCON        | a    |
| 1709 | FREDDA LARA          | a    |
| 2217 | LORIANN DELROSARIO   | a    |
| 2305 | SARA AVILA           | a    |
| 2631 | ROSARIA DELONG       | a    |
| 3245 | LARA MASTERSON       | a    |
| 3267 | LARA MOREAU          | a    |
| 3553 | SARAN CHANG          | a    |
| 3880 | SARAN HOOK           | a    |
| 3980 | GEORGETTA DELROSARIO | a    |
| 4517 | SARAI EASLEY         | a    |
| 5708 | ASA ROSARIO          | a    |
| 5731 | SARITA ANDERS        | a    |
| 6100 | CHANTELL SARABIA     | a    |
| 6165 | SARA HALLMAN         | a    |
| 6480 | SARAH NEILL          | a    |
| 6488 | SARAN PARTIN         | a    |
| 6802 | KLARA ROLLER         | a    |
+------+----------------------+------+
––– input –––
mysql -h0 -P9306 -e "SELECT username FROM name WHERE MATCH('SMITH') OPTION cutoff=0, ranker=expr('sum((4*lcs+2*(min_hit_pos=1)+exact_hit)*user_weight)*1000+bm25'), field_weights=(username=1), fuzzy=1;"
––– output –––
+----------------+
| username       |
+----------------+
| MINH FENNELL   |
| MINH MAZUR     |
| MINH VILLEGAS  |
| MINH TILLER    |
| MINH VOGT      |
| MINH SHAW      |
| MINH STEADMAN  |
| MINH PEAK      |
| MINH ROOT      |
| MINH PATTERSON |
| MINH BURDETTE  |
| MINH ABNEY     |
| MINH DOLAN     |
| MINH RUDD      |
| MINH TOLBERT   |
| MINH CRANDALL  |
| MINH JAIME     |
| MINH ISAACSON  |
| MINH BONILLA   |
| MINH WAHL      |
+----------------+
––– input –––
mysql -h0 -P9306 -e "SELECT username FROM name WHERE MATCH('SMITH') OPTION cutoff=0, field_weights=(username=1), fuzzy=1;"
––– output –––
+-----------------+
| username        |
+-----------------+
| SYDNEY SMYTH    |
| CHERILYN SMYTH  |
| SATURNINA SMYTH |
| LYNN SMYTH      |
| STEVEN SMYTH    |
| JASMIN SMYTH    |
| BERYL SMYTH     |
| JACK SMYTH      |
| CAROLEE SMYTH   |
| CARON SMYTH     |
| ALFREDO SMYTH   |
| ALTA SMYTH      |
| VIKI SMYTH      |
| CHANA SMYTH     |
| HYUN SMYTH      |
| ROGER SMYTH     |
| LINDSEY SMYTH   |
| WILFORD SMYTH   |
| ARLINE SMYTH    |
| APRYL SMYTH     |
+-----------------+
––– input –––
mysql -h0 -P9306 -e "SELECT username FROM name WHERE MATCH('SMITH') OPTION cutoff=0, ranker=expr('sum((4*lcs+2*(min_hit_pos=1)+exact_hit)*user_weight)*1000+bm25'), fuzzy=1;"
––– output –––
+----------------+
| username       |
+----------------+
| MINH FENNELL   |
| MINH MAZUR     |
| MINH VILLEGAS  |
| MINH TILLER    |
| MINH VOGT      |
| MINH SHAW      |
| MINH STEADMAN  |
| MINH PEAK      |
| MINH ROOT      |
| MINH PATTERSON |
| MINH BURDETTE  |
| MINH ABNEY     |
| MINH DOLAN     |
| MINH RUDD      |
| MINH TOLBERT   |
| MINH CRANDALL  |
| MINH JAIME     |
| MINH ISAACSON  |
| MINH BONILLA   |
| MINH WAHL      |
+----------------+
––– input –––
mysql -h0 -P9306 -e "SELECT username FROM name WHERE MATCH('SMITH') OPTION cutoff=0, fuzzy=1;"
––– output –––
+-----------------+
| username        |
+-----------------+
| SYDNEY SMYTH    |
| CHERILYN SMYTH  |
| SATURNINA SMYTH |
| LYNN SMYTH      |
| STEVEN SMYTH    |
| JASMIN SMYTH    |
| BERYL SMYTH     |
| JACK SMYTH      |
| CAROLEE SMYTH   |
| CARON SMYTH     |
| ALFREDO SMYTH   |
| ALTA SMYTH      |
| VIKI SMYTH      |
| CHANA SMYTH     |
| HYUN SMYTH      |
| ROGER SMYTH     |
| LINDSEY SMYTH   |
| WILFORD SMYTH   |
| ARLINE SMYTH    |
| APRYL SMYTH     |
+-----------------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS fuzziness);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'us,ru' AS layouts);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 0 AS prepend);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| johnny |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS prepend, 1 AS append);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– 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    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– 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   |
| joey  |
| john  |
| jon   |
| jose  |
| joy   |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS prepend);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 1 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'us' AS layouts);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('jo', 'name', 'ru' AS layouts);" | tail -n +4 | sort
––– output –––
+--------+
| joe    |
| joey   |
| john   |
| jon    |
| jordan |
| jose   |
| joseph |
| joy    |
| joyce  |
| major  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('al', 'name', 0 AS fuzziness);" | tail -n +4 | sort
––– output –––
+-----------+
| albert    |
| alexander |
| ali       |
| dale      |
| gale      |
| kendall   |
| marshall  |
| palma     |
| valentine |
| walter    |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('mi', 'name', 0 AS append, 1 AS prepend);" | tail -n +4 | sort
––– output –––
~ +----------+
~ | britncami   |
~ | brittanidarci  |
~ | cami  joan   |
~ | choi  jody   |
~ | darcijoe    |
~ | jenni oel   |
~ | joi   ey   |
~ | kaci  john   |
~ | kami    johnie |
~ | kimi    johnny |
~ | laci joi    |
~ | leilanijon    |
~ | luci   jonas  |
~ | mancini jordan |
~ | marci  jorge  |
~ | mi    jose   |
~ | muoi    joseph |
~ | nanci  joshi  |
~ | naomi   joshua |
~ | neomijoy    |
~ | nohemi joyce  |
~ | penni kaci   |
~ | ricci kami   |
~ | roni  kimi   |
~ | shani laci   |
~ | staci luci   |
~ | stefanmarci  |
~ | tami     |
~ | tammi  nanci  |
~ | tiffannaomi  |
~ | toi    neomi  |
~ | tomi    nohemi |
~ | traci  ricci  |
+ | staci  |
+ | tami   |
+ | tammi  |
+ | tobias |
+ | todd   |
+ | toi    |
+ | tom    |
+ | tomas  |
+ | tomi   |
+ | toney  |
+ | traci  |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('ch', 'name', 1 AS fuzziness, 3 AS expansion_len);" | tail -n +4 | sort
––– output –––
+-------+
| chang |
| chong |
| chung |
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('зф', 'name', 'us,ru' AS layouts);" | tail -n +4 | sort
––– output –––
+----------+
| page     |
| paige    |
| palma    |
| paris    |
| parker   |
| pat      |
| patricia |
| 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 |
| grey    |
| grogan  |
| grover  |
––– 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'; 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';"; echo $?
––– output –––
0
––– input –––
mysql -h0 -P9306 -e "INSERT INTO idx1(value) VALUES ('340');"; echo $?
––– output –––
0
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('34', 'idx1');"
––– output –––
+-------+
| query |
+-------+
| 340   |
+-------+
––– input –––
mysql -h0 -P9306 -e "CALL AUTOCOMPLETE('3', 'idx1');"; echo $?
––– output –––
0
––– 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; echo $?
––– output –––
0
––– input –––
echo -e "1\tabcdef\n2\tabcd efgh\n3\trandom text" > /tmp/data.tsv; echo $?
––– output –––
0
––– input –––
mkdir -p /tmp/idx_plain && chmod 777 /tmp/idx_plain; echo $?
––– output –––
0
––– input –––
indexer --all --config /tmp/manticore_idx.conf > /dev/null 2>&1; echo $?
––– output –––
0
––– input –––
rm -f /tmp/searchd.log; stdbuf -oL searchd --stopwait > /dev/null; (stdbuf -oL searchd -c /tmp/manticore_idx.conf 2>&1 | tee /tmp/searchd.log | grep -i precach & disown); sleep 0.5; if timeout 10 grep -qm1 '\[BUDDY\] started' /tmp/searchd.log; then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /tmp/searchd.log; fi
––– output –––
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 "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');"; echo $?
––– output –––
0
––– 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
Collaborator

@sanikolaev sanikolaev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add set global query_log_min_msec=0 and test that after this UPDATEs are logged.

@PavelShilin89
Copy link
Contributor Author

Добавьте set global query_log_min_msec=0и проверьте, что после этого ОБНОВЛЕНИЯ будут зарегистрированы.

If you remove query_log_min_msec = 500 from the config, the query is logged. Is this not enough?

@PavelShilin89
Copy link
Contributor Author

Добавьте set global query_log_min_msec=0и проверьте, что после этого ОБНОВЛЕНИЯ будут зарегистрированы.

@sanikolaev Or do I need to add such a case study to the test?

@sanikolaev
Copy link
Collaborator

If you remove query_log_min_msec = 500 from the config, the query is logged. Is this not enough?

It's enough too, but with set global query_log_min_msec=0:

  • you don't have to modify the config and restart searchd in the test, you just perform one simple sql query
  • you test that set set global query_log_min_msec works

@PavelShilin89
Copy link
Contributor Author

If you remove query_log_min_msec = 500 from the config, the query is logged. Is this not enough?

It's enough too, but with set global query_log_min_msec=0:

  • you don't have to modify the config and restart searchd in the test, you just perform one simple sql query
  • you test that set set global query_log_min_msec works

I know what you mean, I was just testing by removing this parameter from the configuration and restarting the test.
Now I have added a new case using set set global query_log_min_msec.
Merger approval is required.

@sanikolaev
Copy link
Collaborator

I've made a minor imp. Otherwise LGTM.

@PavelShilin89 PavelShilin89 merged commit 7d1e4ed into master Mar 19, 2025
46 checks passed
@PavelShilin89 PavelShilin89 deleted the test/query-log-min-msec-is-ignored-for-update branch March 19, 2025 17:24
@PavelShilin89 PavelShilin89 linked an issue Mar 19, 2025 that may be closed by this pull request
5 tasks
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.

query_log_min_msec is ignored for UPDATEs
2 participants