Skip to content

Instantly share code, notes, and snippets.

@pruet
Created June 16, 2016 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pruet/d829a61d39951d9b9d58543e32e83d84 to your computer and use it in GitHub Desktop.
Save pruet/d829a61d39951d9b9d58543e32e83d84 to your computer and use it in GitHub Desktop.
TestFulltextThaiBoolean
mysql> select text, match text against ('+Jack -ผชาย' in boolean mode) as score from t;;
+--------------------------------------------------+--------------------+
| text | score |
+--------------------------------------------------+--------------------+
| กาบินมา | 0 |
| กาบินไป | 0 |
| กาบินมาบินไป | 0 |
| เด็กเกาแขน | 0 |
| เด็กเกาแขนขาไปมา | 0 |
| John เป็นผู้ชาย | 0 |
| John Silver | 0 |
| เด็กเก้าคน | 0 |
| Jack เป็นเด็กผู้ชาย | 0 |
| Jack Silver | 0.4885590672492981 |
+--------------------------------------------------+--------------------+
10 rows in set (0.00 sec)
ERROR:
No query specified
mysql> select text from t;
+--------------------------------------------------+
| text |
+--------------------------------------------------+
| กาบินมา |
| กาบินไป |
| กาบินมาบินไป |
| เด็กเกาแขน |
| เด็กเกาแขนขาไปมา |
| John เป็นผู้ชาย |
| John Silver |
| เด็กเก้าคน |
| Jack เป็นเด็กผู้ชาย |
| Jack Silver |
+--------------------------------------------------+
10 rows in set (0.00 sec)
mysql> select text, match text against ('+Jack -ผชาย' in boolean mode) as score from t;;
+--------------------------------------------------+--------------------+
| text | score |
+--------------------------------------------------+--------------------+
| กาบินมา | 0 |
| กาบินไป | 0 |
| กาบินมาบินไป | 0 |
| เด็กเกาแขน | 0 |
| เด็กเกาแขนขาไปมา | 0 |
| John เป็นผู้ชาย | 0 |
| John Silver | 0 |
| เด็กเก้าคน | 0 |
| Jack เป็นเด็กผู้ชาย | 0 |
| Jack Silver | 0.4885590672492981 |
+--------------------------------------------------+--------------------+
10 rows in set (0.00 sec)
ERROR:
No query specified
mysql> select text, match text against ('+ผชาย -John' in boolean mode) as score from t;;
+--------------------------------------------------+--------------------+
| text | score |
+--------------------------------------------------+--------------------+
| กาบินมา | 0 |
| กาบินไป | 0 |
| กาบินมาบินไป | 0 |
| เด็กเกาแขน | 0 |
| เด็กเกาแขนขาไปมา | 0 |
| John เป็นผู้ชาย | 0 |
| John Silver | 0 |
| เด็กเก้าคน | 0 |
| Jack เป็นเด็กผู้ชาย | 0.4885590672492981 |
| Jack Silver | 0 |
+--------------------------------------------------+--------------------+
10 rows in set (0.00 sec)
ERROR:
No query specified
mysql>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment