Bug #349
前方一致検索の結果が異なる
| Status: | 完了 | Start date: | 06/21/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | 1.0 |
Description
groongaとtritonnとで、テキストの前方一致検索をした場合、検索結果が異なる場合がある。
groongaの場合:
table_create --name searchtest --flags TABLE_HASH_KEY --key_type UInt8 table_create --name searchtest_index --flags TABLE_PAT_KEY|KEY_NORMALIZE --type ShortText --default_tokenizer TokenBigram column_create --table searchtest --name words --flags COLUMN_SCALAR --type ShortText column_create --table searchtest_index --name word --flags COLUMN_INDEX|WITH_SECTION|WITH_POSITION --type searchtest --source words load --table searchtest --input_type json --output_type json [ ["_key","words"], [1,"aki"], [2,"akihabara"], ] select searchtest select searchtest --query words:@aki* select searchtest --query words:@a*
> table_create --name searchtest --flags TABLE_HASH_KEY --key_type UInt8 [[0,1277112400.63585,0.001694]] > table_create --name searchtest_index --flags TABLE_PAT_KEY|KEY_NORMALIZE --type ShortText --default_tokenizer TokenBigram [[0,1277112405.0999,0.023584]] > column_create --table searchtest --name words --flags COLUMN_SCALAR --type ShortText [[0,1277112407.86787,0.02668]] > column_create --table searchtest_index --name word --flags COLUMN_INDEX|WITH_SECTION|WITH_POSITION --type searchtest --source words [[0,1277112410.89191,0.043828]] > load --table searchtest --input_type json --output_type json > [ > ["_key","words"], > [1,"aki"], > [2,"akihabara"], > ] [[0,1277112415.21585,0.059942],2] > select searchtest [[0,1277112427.7598,0.000244],[[[2],[["_id","UInt32"],["_key","UInt8"],["words","ShortText"]],[1,1,"aki"],[2,2,"akihabara"]]]] > select searchtest --query words:@aki* [[0,1277112430.66782,0.000564],[[[1],[["_id","UInt32"],["_key","UInt8"],["words","ShortText"]],[1,1,"aki"]]]] > select searchtest --query words:@a* [[0,1277112433.45582,0.000548],[[[1],[["_id","UInt32"],["_key","UInt8"],["words","ShortText"]],[2,2,"akihabara"]]]] >
tritonnの場合:
CREATE TABLE `searchtest` (
`_key` int(2) NOT NULL,
`words` text,
PRIMARY KEY (`_key`),
FULLTEXT KEY `words` (`words`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `searchtest` VALUES (1,'aki'),(2,'akihabara');
SELECT * FROM `searchtest`;
SELECT * FROM `searchtest` WHERE MATCH(`words`) AGAINST('+aki*' IN BOOLEAN MODE);
SELECT * FROM `searchtest` WHERE MATCH(`words`) AGAINST('+a*' IN BOOLEAN MODE);
mysql> CREATE TABLE `searchtest` (
-> `_key` int(2) NOT NULL,
-> `words` text,
-> PRIMARY KEY (`_key`),
-> FULLTEXT KEY `words` (`words`)
-> ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.12 sec)
mysql> INSERT INTO `searchtest` VALUES (1,'aki'),(2,'akihabara');
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> SELECT * FROM `searchtest`;
+------+-----------+
| _key | words |
+------+-----------+
| 1 | aki |
| 2 | akihabara |
+------+-----------+
2 rows in set (0.00 sec)
mysql> SELECT * FROM `searchtest` WHERE MATCH(`words`) AGAINST('+aki*' IN BOOLEAN MODE);
+------+-------+
| _key | words |
+------+-------+
| 1 | aki |
+------+-------+
1 row in set (0.00 sec)
mysql> SELECT * FROM `searchtest` WHERE MATCH(`words`) AGAINST('+a*' IN BOOLEAN MODE);
+------+-----------+
| _key | words |
+------+-----------+
| 1 | aki |
| 2 | akihabara |
+------+-----------+
2 rows in set (0.00 sec)
mysql>
Related issues
History
Updated by Yutaro Shimamura almost 2 years ago
- Status changed from 新規 to 原因判明
- Assignee set to Yutaro Shimamura
- queryでgrn_pat_prefix_searchにおいてパースが正常に実行できていなく、"^query"このような形式で直接渡ってきてしまっている。
- filterで'col @^ "query"'がうまく動作していない
Updated by Yutaro Shimamura almost 2 years ago
- index作成のところ
type -> key_typeに
- prefix_searchは@^で実行される。(別の問題あり)
select searchtest --filter 'words @ "ak"'
[[[2],[["_id","UInt32"],["_key","UInt8"],["words","ShortText"]],[1,1,"aki"],[2,2,"akihabara"]]]
こんな感じ。
Updated by Tasuku SUENAGA over 1 year ago
- Target version set to 1.0
Updated by daijiro MORI over 1 year ago
- Status changed from 完了チェック待ち to 完了