[groonga-dev,02796] Boolean Modeの*の仕様

Back to archive index

Kazuhiko kazuh****@fdiar*****
2014年 9月 24日 (水) 18:19:45 JST


こんにちは、かずひこです。

Boolean Modeにおける*の仕様について疑問があります。

http://mroonga.org/ja/docs/reference/full_text_search/boolean_mode.html
には、
The asterisk serves as the truncation (or wildcard) operator.
とありますが、前方一致、後方一致、中間一致のどれでも使えるものでしょうか?

以下、TokenBigramでの例です。

> SELECT *, MATCH (content) AGAINST ("to*" in boolean mode) AS score
FROM diaries;
+----+--------------------------------------------------+-------+
| id | content                                          | score |
+----+--------------------------------------------------+-------+
|  1 | It'll be fine tomorrow as well.                  |     1 |
|  2 | It'll rain tomorrow.                             |     1 |
|  3 | It's fine today. It'll be fine tomorrow as well. |     2 |
|  4 | It's fine today. But it'll rain tomorrow.        |     2 |
|  5 | Ring the bell.                                   |     0 |
|  6 | I love dumbbells.                                |     0 |
+----+--------------------------------------------------+-------+

期待通り、'to*'がtodayにもtomorrowにもヒットしているようです。

> SELECT *, MATCH (content) AGAINST ("*day" in boolean mode) AS score
FROM diaries;
+----+--------------------------------------------------+-------+
| id | content                                          | score |
+----+--------------------------------------------------+-------+
|  1 | It'll be fine tomorrow as well.                  |     1 |
|  2 | It'll rain tomorrow.                             |     1 |
|  3 | It's fine today. It'll be fine tomorrow as well. |     1 |
|  4 | It's fine today. But it'll rain tomorrow.        |     1 |
|  5 | Ring the bell.                                   |     0 |
|  6 | I love dumbbells.                                |     0 |
+----+--------------------------------------------------+-------+

'*day'がid=1やid=2にヒットするのは何故でしょうか? ちなみに

> SELECT *, MATCH (content) AGAINST ("*" in boolean mode) AS score FROM
diaries;
+----+--------------------------------------------------+-------+
| id | content                                          | score |
+----+--------------------------------------------------+-------+
|  1 | It'll be fine tomorrow as well.                  |     1 |
|  2 | It'll rain tomorrow.                             |     1 |
|  3 | It's fine today. It'll be fine tomorrow as well. |     1 |
|  4 | It's fine today. But it'll rain tomorrow.        |     1 |
|  5 | Ring the bell.                                   |     0 |
|  6 | I love dumbbells.                                |     0 |
+----+--------------------------------------------------+-------+

'*'だけの結果も全く同じになりました。

Boolean Modeでの'*'の期待される仕様や制限について教えてくださると幸いです。

かずひこ




groonga-dev メーリングリストの案内
Back to archive index