Debian Codegraph @

mysql-test/suite/storage_engine/fulltext_search.test

raw
1 #
2 # Full-text indexes and search
3 #
4
5 --source have_engine.inc
6
7 --disable_warnings
8 DROP TABLE IF EXISTS t1;
9 --enable_warnings
10
11 let $create_definition =
12 v0 VARCHAR(64) $col_opts,
13 v1 VARCHAR(16384) $col_indexed_opts,
14 v2 TEXT $col_opts,
15 FULLTEXT v1 (v1)
16 ;
17 --source create_table.inc
18 if ($mysql_errname)
19 {
20 --let $functionality = FULLTEXT indexes or VARCHAR|TEXT data types
21 --source unexpected_result.inc
22 }
23 if (!$mysql_errname)
24 {
25 --replace_column 6 # 7 #
26 SHOW INDEXES IN t1;
27
28 INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
29
30 If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
31 For developers who want to code on MariaDB or MySQL
32
33 * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
34 o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
35 o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
36 * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
37 o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
38
39 For MariaDB / MySQL end users
40
41 * MariaDB Crash Course by Ben Forta
42 o First MariaDB book!
43 o For people who want to learn SQL and the basics of MariaDB.
44 o Now shipping. Purchase at Amazon.com or your favorite bookseller.
45
46 * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
47 o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
48 o Free to read in the Knowledgebase!
49
50 * MySQL (4th Edition) by Paul DuBois
51 o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
52
53 * MySQL Cookbook by Paul DuBois
54 o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
55
56 * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
57 o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
58
59 * MySQL Admin Cookbook
60 o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
61
62 * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
63 o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
64
65 'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
66
67 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
68 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
69 3. With MariaDB everyone has access to the latest code.
70 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
71 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
72
73 The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
74 ), ('text2','test1','test2');
75
76 # 50% rule -- no result if the string is represented in at least 50% rows
77 SELECT v0 FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
78
79 # Adding a row to start getting results
80 INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
81 SELECT v0, MATCH(v1) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
82
83 INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
84 SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
85
86 # Boolean mode
87
88 SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
89 SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
90
91 # Query expansion
92
93 SELECT v0, MATCH(v1) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('database' WITH QUERY EXPANSION);
94 DROP TABLE t1;
95 }
96
97
98 let $create_definition =
99 v0 VARCHAR(64) $col_opts,
100 v1 VARCHAR(16384) $col_opts,
101 v2 TEXT $col_opts,
102 FULLTEXT v1 (v1),
103 FULLTEXT v1_v2 (v1,v2)
104 ;
105 --source create_table.inc
106 if ($mysql_errname)
107 {
108 --let $functionality = FULLTEXT indexes or multiple keys or VARCHAR|TEXT data types
109 --source unexpected_result.inc
110 }
111 if (!$mysql_errname)
112 {
113 --replace_column 6 # 7 #
114 SHOW INDEXES IN t1;
115
116 INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
117
118 If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
119 For developers who want to code on MariaDB or MySQL
120
121 * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
122 o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
123 o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
124 * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
125 o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
126
127 For MariaDB / MySQL end users
128
129 * MariaDB Crash Course by Ben Forta
130 o First MariaDB book!
131 o For people who want to learn SQL and the basics of MariaDB.
132 o Now shipping. Purchase at Amazon.com or your favorite bookseller.
133
134 * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
135 o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
136 o Free to read in the Knowledgebase!
137
138 * MySQL (4th Edition) by Paul DuBois
139 o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
140
141 * MySQL Cookbook by Paul DuBois
142 o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
143
144 * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
145 o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
146
147 * MySQL Admin Cookbook
148 o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
149
150 * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
151 o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
152
153 'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
154
155 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
156 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
157 3. With MariaDB everyone has access to the latest code.
158 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
159 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
160
161 The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
162 ), ('text2','test1','test2');
163
164 # 50% rule -- no result if the string is represented in at least 50% rows
165 SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
166
167 # Adding a row to start getting results
168 INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
169 SELECT v0, MATCH(v1,v2) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
170
171 INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
172 SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
173
174 # Boolean mode
175
176 SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
177 SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
178
179 # Query expansion
180
181 SELECT v0, MATCH(v1,v2) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('database' WITH QUERY EXPANSION);
182
183 DROP TABLE t1;
184 }
185
186 --source cleanup_engine.inc
187