[groonga-dev,02052] Re: Mroonga、Groongaにおける空レコードの検索について

Back to archive index

Naoya Murakami visio****@gmail*****
2014年 1月 12日 (日) 01:03:51 JST


お世話になっております。村上です。

失礼しました。先ほどは、途中で送信されてしまいました。

空レコード(not null)をGroonga、およびMroongaで検索することができません。
空レコードを検索できるようにできませんでしょうか?

・テーブル
CREATE TABLE IF NOT EXISTS `test` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tag` varchar(10) NOT NULL,
  `text` text NOT NULL,
  PRIMARY KEY (`id`),
  KEY `tag` (`tag`)
) ENGINE=mroonga  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

INSERT INTO `test` (`id`, `tag`, `text`) VALUES (1, 'A01', 'test'),(2,
'A02', 'test2'),(3, '', 'test3');

mysql> SELECT * FROM test;
+----+-----+-------+
| id | tag | text  |
+----+-----+-------+
|  1 | A01 | test  |
|  2 | A02 | test2 |
|  3 |     | test3 |
+----+-----+-------+
3 rows in set (0.00 sec)


・Mroonga
SELECT * FROM test WHERE tag = "";
Empty set (0.00 sec)

mysql> SELECT * FROM test WHERE tag = "A01";
+----+-----+------+
| id | tag | text |
+----+-----+------+
|  1 | A01 | test |
+----+-----+------+
1 row in set (0.01 sec)

・Groonga
mysql> select mroonga_command("select test --query 'tag:\"\"");
+----------------------------------------------------------------------------------------------------+
| mroonga_command("select test --query
'tag:\"\"")                                                   |
+----------------------------------------------------------------------------------------------------+
|
[[[0],[["_id","UInt32"],["_key","Int32"],["id","Int32"],["tag","ShortText"],["text","LongText"]]]]
|
+----------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select mroonga_command("select test --query 'tag:\"A01\"");
+-------------------------------------------------------------------------------------------------------------------------+
| mroonga_command("select test --query
'tag:\"A01\"")
|
+-------------------------------------------------------------------------------------------------------------------------+
|
[[[1],[["_id","UInt32"],["_key","Int32"],["id","Int32"],["tag","ShortText"],["text","LongText"]],[1,1,1,"A01","test"]]]
|
+-------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

また、空レコードを否定で検索すると、Mroongaの方では、レコードが2重に返ってきます。

mysql> SELECT * FROM test WHERE tag != "";
+----+-----+-------+
| id | tag | text  |
+----+-----+-------+
|  1 | A01 | test  |
|  2 | A02 | test2 |
|  1 | A01 | test  |
|  2 | A02 | test2 |
+----+-----+-------+
4 rows in set (0.02 sec)

mysql> select mroonga_command("select test --query 'tag:!\"\"");
+-----------------------------------------------------------------------------------------------------------------------------------------------+
| mroonga_command("select test --query
'tag:!\"\"")
|
+-----------------------------------------------------------------------------------------------------------------------------------------------+
|
[[[2],[["_id","UInt32"],["_key","Int32"],["id","Int32"],["tag","ShortText"],["text","LongText"]],[1,1,1,"A01","test"],[2,2,2,"A02","test2"]]]
|
+-----------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

・バージョン
Groonga 3.1.1
Mroonga 3.11
MySQL 5.6.14
(Groonga 3.1.0 Mroonga 3.10 MariaDB10.0.6でも同じでした)

以上、よろしくお願いします。



2014年1月12日 0:49 Naoya Murakami <visio****@gmail*****>:

> お世話になっております。村上です。において、
>
>
>
>
>
>
>
>
> ・バージョン
> Groonga 3.1.1
> Mroonga 3.11
> MySQL 5.6.14
> (MariaDB10.0.6でも同じでした)
>



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