Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mroonga_boolean_mode_syntax_flags system and session variable
You can customize syntax `MATCH () AGAINST ("..." IN BOOLEAN MODE)`.
Available flags:
* DEFAULT: Equals to SYNTAX_QUERY,ALLOW_LEADING_NOT.
* SYNTAX_QUERY: Uses query grnexpr syntax. If neither SYNTAX_QUERY nor
SYNTAX_SCRIPT aren't specified, SYNTAX_QUERY is used.
* SYNTAX_SCRIPT: Uses script grnexpr syntax. If both SYNTAX_QUERY and
SYNTAX_SCRIPT are specified, SYNTAX_SCRIPT is used.
* ALLOW_COLUMN: Allows "COLUMN:..." syntax in query grnexpr syntax.
* ALLOW_UPDATE: Allows updating value byb "COLUMN:=NEW_VALUE" syntax
in query grnexpr syntax.
* ALLOW_LEADING_NOT: Allows "-NOT_INCLUDED_KEYWORD ..." syntax
in query grnexpr syntax.
TODO:
* Document me.- Loading branch information
Showing
12 changed files
with
357 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
mysql-test/mroonga/storage/variable/boolean_mode_syntax_flags/r/allow_column.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| SET @mroonga_boolean_mode_syntax_flags_backup = | ||
| @@mroonga_boolean_mode_syntax_flags; | ||
| SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_COLUMN"; | ||
| SET NAMES UTF8; | ||
| CREATE TABLE diaries ( | ||
| title TEXT, | ||
| content TEXT, | ||
| FULLTEXT KEY (title), | ||
| FULLTEXT KEY (content) | ||
| ) DEFAULT CHARSET=utf8; | ||
| INSERT INTO diaries VALUES("Groonga", "Hello Groonga"); | ||
| SELECT * FROM diaries | ||
| WHERE MATCH(title) AGAINST("content:@Hello" IN BOOLEAN MODE); | ||
| title content | ||
| Groonga Hello Groonga | ||
| DROP TABLE diaries; | ||
| SET mroonga_boolean_mode_syntax_flags = | ||
| @mroonga_boolean_mode_syntax_flags_backup; |
16 changes: 16 additions & 0 deletions
16
mysql-test/mroonga/storage/variable/boolean_mode_syntax_flags/r/allow_leading_not.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| SET @mroonga_boolean_mode_syntax_flags_backup = | ||
| @@mroonga_boolean_mode_syntax_flags; | ||
| SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_LEADING_NOT"; | ||
| SET NAMES UTF8; | ||
| CREATE TABLE diaries ( | ||
| title TEXT, | ||
| FULLTEXT KEY (title) | ||
| ) DEFAULT CHARSET=utf8; | ||
| INSERT INTO diaries VALUES("Groonga"); | ||
| INSERT INTO diaries VALUES("Mroonga"); | ||
| SELECT * FROM diaries WHERE MATCH(title) AGAINST("-Groonga" IN BOOLEAN MODE); | ||
| title | ||
| Mroonga | ||
| DROP TABLE diaries; | ||
| SET mroonga_boolean_mode_syntax_flags = | ||
| @mroonga_boolean_mode_syntax_flags_backup; |
18 changes: 18 additions & 0 deletions
18
mysql-test/mroonga/storage/variable/boolean_mode_syntax_flags/r/allow_update.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| SET @mroonga_boolean_mode_syntax_flags_backup = | ||
| @@mroonga_boolean_mode_syntax_flags; | ||
| SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_COLUMN,ALLOW_UPDATE"; | ||
| SET NAMES UTF8; | ||
| CREATE TABLE diaries ( | ||
| title TEXT, | ||
| content TEXT, | ||
| FULLTEXT KEY (title), | ||
| FULLTEXT KEY (content) | ||
| ) DEFAULT CHARSET=utf8; | ||
| INSERT INTO diaries VALUES("Groonga", "Hello Groonga"); | ||
| SELECT * FROM diaries | ||
| WHERE MATCH(title) AGAINST('content:="Hello Mroonga"' IN BOOLEAN MODE); | ||
| title content | ||
| Groonga Hello Mroonga | ||
| DROP TABLE diaries; | ||
| SET mroonga_boolean_mode_syntax_flags = | ||
| @mroonga_boolean_mode_syntax_flags_backup; |
15 changes: 15 additions & 0 deletions
15
mysql-test/mroonga/storage/variable/boolean_mode_syntax_flags/r/syntax_query.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| SET @mroonga_boolean_mode_syntax_flags_backup = | ||
| @@mroonga_boolean_mode_syntax_flags; | ||
| SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY"; | ||
| SET NAMES UTF8; | ||
| CREATE TABLE diaries ( | ||
| title TEXT, | ||
| FULLTEXT KEY (title) | ||
| ) DEFAULT CHARSET=utf8; | ||
| INSERT INTO diaries VALUES("Re:Mroonga"); | ||
| SELECT * FROM diaries WHERE MATCH(title) AGAINST("Re:Mroonga" IN BOOLEAN MODE); | ||
| title | ||
| Re:Mroonga | ||
| DROP TABLE diaries; | ||
| SET mroonga_boolean_mode_syntax_flags = | ||
| @mroonga_boolean_mode_syntax_flags_backup; |
16 changes: 16 additions & 0 deletions
16
mysql-test/mroonga/storage/variable/boolean_mode_syntax_flags/r/syntax_script.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| SET @mroonga_boolean_mode_syntax_flags_backup = | ||
| @@mroonga_boolean_mode_syntax_flags; | ||
| SET mroonga_boolean_mode_syntax_flags = "SYNTAX_SCRIPT"; | ||
| SET NAMES UTF8; | ||
| CREATE TABLE diaries ( | ||
| title TEXT, | ||
| FULLTEXT KEY (title) | ||
| ) DEFAULT CHARSET=utf8; | ||
| INSERT INTO diaries VALUES("Re:Mroonga"); | ||
| SELECT * FROM diaries | ||
| WHERE MATCH(title) AGAINST("title @ 'Re:Mroonga'" IN BOOLEAN MODE); | ||
| title | ||
| Re:Mroonga | ||
| DROP TABLE diaries; | ||
| SET mroonga_boolean_mode_syntax_flags = | ||
| @mroonga_boolean_mode_syntax_flags_backup; |
43 changes: 43 additions & 0 deletions
43
mysql-test/mroonga/storage/variable/boolean_mode_syntax_flags/t/allow_column.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com> | ||
| # | ||
| # This library is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU Lesser General Public | ||
| # License as published by the Free Software Foundation; either | ||
| # version 2.1 of the License, or (at your option) any later version. | ||
| # | ||
| # This library is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| # Lesser General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU Lesser General Public | ||
| # License along with this library; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
|
||
| --source ../../../../include/mroonga/have_mroonga.inc | ||
|
|
||
| SET @mroonga_boolean_mode_syntax_flags_backup = | ||
| @@mroonga_boolean_mode_syntax_flags; | ||
|
|
||
| SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_COLUMN"; | ||
|
|
||
| SET NAMES UTF8; | ||
|
|
||
| CREATE TABLE diaries ( | ||
| title TEXT, | ||
| content TEXT, | ||
| FULLTEXT KEY (title), | ||
| FULLTEXT KEY (content) | ||
| ) DEFAULT CHARSET=utf8; | ||
|
|
||
| INSERT INTO diaries VALUES("Groonga", "Hello Groonga"); | ||
|
|
||
| SELECT * FROM diaries | ||
| WHERE MATCH(title) AGAINST("content:@Hello" IN BOOLEAN MODE); | ||
|
|
||
| DROP TABLE diaries; | ||
|
|
||
| SET mroonga_boolean_mode_syntax_flags = | ||
| @mroonga_boolean_mode_syntax_flags_backup; | ||
|
|
||
| --source ../../../../include/mroonga/have_mroonga_deinit.inc |
41 changes: 41 additions & 0 deletions
41
mysql-test/mroonga/storage/variable/boolean_mode_syntax_flags/t/allow_leading_not.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com> | ||
| # | ||
| # This library is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU Lesser General Public | ||
| # License as published by the Free Software Foundation; either | ||
| # version 2.1 of the License, or (at your option) any later version. | ||
| # | ||
| # This library is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| # Lesser General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU Lesser General Public | ||
| # License along with this library; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
|
||
| --source ../../../../include/mroonga/have_mroonga.inc | ||
|
|
||
| SET @mroonga_boolean_mode_syntax_flags_backup = | ||
| @@mroonga_boolean_mode_syntax_flags; | ||
|
|
||
| SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_LEADING_NOT"; | ||
|
|
||
| SET NAMES UTF8; | ||
|
|
||
| CREATE TABLE diaries ( | ||
| title TEXT, | ||
| FULLTEXT KEY (title) | ||
| ) DEFAULT CHARSET=utf8; | ||
|
|
||
| INSERT INTO diaries VALUES("Groonga"); | ||
| INSERT INTO diaries VALUES("Mroonga"); | ||
|
|
||
| SELECT * FROM diaries WHERE MATCH(title) AGAINST("-Groonga" IN BOOLEAN MODE); | ||
|
|
||
| DROP TABLE diaries; | ||
|
|
||
| SET mroonga_boolean_mode_syntax_flags = | ||
| @mroonga_boolean_mode_syntax_flags_backup; | ||
|
|
||
| --source ../../../../include/mroonga/have_mroonga_deinit.inc |
43 changes: 43 additions & 0 deletions
43
mysql-test/mroonga/storage/variable/boolean_mode_syntax_flags/t/allow_update.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com> | ||
| # | ||
| # This library is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU Lesser General Public | ||
| # License as published by the Free Software Foundation; either | ||
| # version 2.1 of the License, or (at your option) any later version. | ||
| # | ||
| # This library is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| # Lesser General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU Lesser General Public | ||
| # License along with this library; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
|
||
| --source ../../../../include/mroonga/have_mroonga.inc | ||
|
|
||
| SET @mroonga_boolean_mode_syntax_flags_backup = | ||
| @@mroonga_boolean_mode_syntax_flags; | ||
|
|
||
| SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_COLUMN,ALLOW_UPDATE"; | ||
|
|
||
| SET NAMES UTF8; | ||
|
|
||
| CREATE TABLE diaries ( | ||
| title TEXT, | ||
| content TEXT, | ||
| FULLTEXT KEY (title), | ||
| FULLTEXT KEY (content) | ||
| ) DEFAULT CHARSET=utf8; | ||
|
|
||
| INSERT INTO diaries VALUES("Groonga", "Hello Groonga"); | ||
|
|
||
| SELECT * FROM diaries | ||
| WHERE MATCH(title) AGAINST('content:="Hello Mroonga"' IN BOOLEAN MODE); | ||
|
|
||
| DROP TABLE diaries; | ||
|
|
||
| SET mroonga_boolean_mode_syntax_flags = | ||
| @mroonga_boolean_mode_syntax_flags_backup; | ||
|
|
||
| --source ../../../../include/mroonga/have_mroonga_deinit.inc |
40 changes: 40 additions & 0 deletions
40
mysql-test/mroonga/storage/variable/boolean_mode_syntax_flags/t/syntax_query.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Copyright(C) 2014 Kouhei Sutou <kou@clear-code.com> | ||
| # | ||
| # This library is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU Lesser General Public | ||
| # License as published by the Free Software Foundation; either | ||
| # version 2.1 of the License, or (at your option) any later version. | ||
| # | ||
| # This library is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| # Lesser General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU Lesser General Public | ||
| # License along with this library; if not, write to the Free Software | ||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
|
||
| --source ../../../../include/mroonga/have_mroonga.inc | ||
|
|
||
| SET @mroonga_boolean_mode_syntax_flags_backup = | ||
| @@mroonga_boolean_mode_syntax_flags; | ||
|
|
||
| SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY"; | ||
|
|
||
| SET NAMES UTF8; | ||
|
|
||
| CREATE TABLE diaries ( | ||
| title TEXT, | ||
| FULLTEXT KEY (title) | ||
| ) DEFAULT CHARSET=utf8; | ||
|
|
||
| INSERT INTO diaries VALUES("Re:Mroonga"); | ||
|
|
||
| SELECT * FROM diaries WHERE MATCH(title) AGAINST("Re:Mroonga" IN BOOLEAN MODE); | ||
|
|
||
| DROP TABLE diaries; | ||
|
|
||
| SET mroonga_boolean_mode_syntax_flags = | ||
| @mroonga_boolean_mode_syntax_flags_backup; | ||
|
|
||
| --source ../../../../include/mroonga/have_mroonga_deinit.inc |
Oops, something went wrong.