提交 5785fdf3 authored 作者: Thomas Mueller's avatar Thomas Mueller

Fulltext search: searching for NULL or an empty string threw an exception.

上级 501228f1
......@@ -469,7 +469,7 @@ public class FullText {
while (rs.next()) {
String schema = rs.getString("TRIGGER_SCHEMA");
String name = rs.getString("TRIGGER_NAME");
if (name.startsWith(TRIGGER_PREFIX)) {
if (name.startsWith(prefix)) {
name = StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(name);
stat2.execute("DROP TRIGGER " + name);
}
......@@ -506,6 +506,9 @@ public class FullText {
// this is just to query the result set columns
return result;
}
if (text == null || text.trim().length() == 0) {
return result;
}
FullTextSettings setting = FullTextSettings.getInstance(conn);
HashSet<String> words = New.hashSet();
addWords(setting, words, text);
......
......@@ -326,6 +326,9 @@ public class FullTextLucene extends FullText {
// this is just to query the result set columns
return result;
}
if (text == null || text.trim().length() == 0) {
return result;
}
String path = getIndexPath(conn);
try {
IndexModifier indexer = getIndexModifier(conn);
......
......@@ -92,6 +92,8 @@ public class TestFullText extends TestBase {
stat = conn.createStatement();
ResultSet rs = stat.executeQuery("SELECT * FROM " + prefix + "_SEARCH('Hello', 0, 0)");
assertTrue(rs.next());
stat.executeQuery("SELECT * FROM " + prefix + "_SEARCH(NULL, 0, 0)");
stat.execute("INSERT INTO TEST VALUES(2, NULL)");
conn.close();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论