三、全文检索
DM与Oracle、Mysql、PostgreSQL 全文检索功能对比表:1-3

DM的全文检索功能是根据其已有词库建立全文索引,然后文本查询完全在索引上进行。我们来测试下
select * from test_context;
id name
1 1 Copied 31 empty directories to 4 empty directories under /u01/dmdb/dmdbms/jar/eclipse
2 2 Replace FILE=/u01/dmdb/dmdbms/desktop/uninstall.desktop
3 3 达梦数据库DMDBDMS
3 rows got
time used: 0.265(ms).
id name
1 1 Copied 31 empty directories to 4 empty directories under /u01/dmdb/dmdbms/jar/eclipse
2 2 Replace FILE=/u01/dmdb/dmdbms/desktop/uninstall.desktop
3 3 达梦数据库DMDBDMS
3 rows got
time used: 0.265(ms).
下面在name字段创建全文索引。
SQL>create context index test_name on test_context(name);
time used: 27.519(ms).
SQL>select a.name,b.name from systables a,syscontextindexes b where a.name='test_context' and a.id=b.tableid;
name name
1 test_context test_name
1 rows got
SQL>select * from test_context where contains(name,'empty');
全文索引 'test_name' 无效,需要重新填充.error code = -1453
SQL>alter context index test_name on test_context rebuild;
time used: 355.452(ms).
SQL>select * from test_context where contains(name,'empty');
id name
1 1 Copied 31 empty directories to 4 empty directories under /u01/dmdb/dmdbms/jar/eclipse
1 rows got
time used: 0.431(ms).
SQL>select * from test_context where contains(name,'达梦');
id name
1 3 达梦数据库DMDBDMS
1 rows got
time used: 0.368(ms).
time used: 27.519(ms).
SQL>select a.name,b.name from systables a,syscontextindexes b where a.name='test_context' and a.id=b.tableid;
name name
1 test_context test_name
1 rows got
SQL>select * from test_context where contains(name,'empty');
全文索引 'test_name' 无效,需要重新填充.error code = -1453
SQL>alter context index test_name on test_context rebuild;
time used: 355.452(ms).
SQL>select * from test_context where contains(name,'empty');
id name
1 1 Copied 31 empty directories to 4 empty directories under /u01/dmdb/dmdbms/jar/eclipse
1 rows got
time used: 0.431(ms).
SQL>select * from test_context where contains(name,'达梦');
id name
1 3 达梦数据库DMDBDMS
1 rows got
time used: 0.368(ms).
从上面的测试可以看出,DM的全文检索在创建后不能马上对其进程查询,需要先进行填充,也就是说每次更新后,更新的数据不能马上用全文检索查出来,需要先填充才会出现在全文索引里。不过DM对中文的支持还是很友好的,不需要在多装其他的插件什么的,毕竟是国产的。