提交 2c4da91e authored 作者: Thomas Mueller's avatar Thomas Mueller

fulltext search now supports clob (but doesn't use reader yet)

上级 bfdaa836
......@@ -6,6 +6,8 @@
*/
package org.h2.fulltext;
import java.io.IOException;
import java.io.Reader;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
......@@ -29,8 +31,10 @@ import org.h2.expression.Expression;
import org.h2.expression.ExpressionColumn;
import org.h2.expression.ValueExpression;
import org.h2.jdbc.JdbcConnection;
import org.h2.message.Message;
import org.h2.tools.SimpleResultSet;
import org.h2.util.ByteUtils;
import org.h2.util.IOUtils;
import org.h2.util.ObjectUtils;
import org.h2.util.JdbcUtils;
import org.h2.util.StringUtils;
......@@ -440,7 +444,11 @@ public class FullText implements Trigger {
case Types.VARCHAR:
return data.toString();
case Types.CLOB:
int test;
try {
return IOUtils.readStringAndClose((Reader) data, -1);
} catch (IOException e) {
throw Message.convert(e);
}
case Types.VARBINARY:
case Types.LONGVARBINARY:
case Types.BINARY:
......@@ -488,7 +496,6 @@ public class FullText implements Trigger {
case Types.BINARY:
return quoteBinary((byte[]) data);
case Types.CLOB:
int test;
case Types.JAVA_OBJECT:
case Types.OTHER:
case Types.BLOB:
......@@ -503,7 +510,7 @@ public class FullText implements Trigger {
return "";
}
}
private static void addWords(FullTextSettings setting, HashSet set, String text) {
StringTokenizer tokenizer = new StringTokenizer(text, " \t\n\r\f+\"*%&/()=?'!,.;:-_#@|^~`{}[]");
while (tokenizer.hasMoreTokens()) {
......
......@@ -8,6 +8,7 @@ package org.h2.fulltext;
//## Java 1.4 begin ##
import java.io.IOException;
import java.io.Reader;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
......@@ -36,9 +37,11 @@ import org.h2.command.Parser;
import org.h2.engine.Session;
import org.h2.expression.ExpressionColumn;
import org.h2.jdbc.JdbcConnection;
import org.h2.message.Message;
import org.h2.store.fs.FileSystem;
import org.h2.tools.SimpleResultSet;
import org.h2.util.ByteUtils;
import org.h2.util.IOUtils;
import org.h2.util.StringUtils;
//## Java 1.4 end ##
......@@ -426,7 +429,11 @@ implements Trigger
case Types.VARCHAR:
return data.toString();
case Types.CLOB:
int todo;
try {
return IOUtils.readStringAndClose((Reader) data, -1);
} catch (IOException e) {
throw Message.convert(e);
}
case Types.VARBINARY:
case Types.LONGVARBINARY:
case Types.BINARY:
......@@ -473,7 +480,6 @@ implements Trigger
case Types.BINARY:
return quoteBinary((byte[]) data);
case Types.CLOB:
int test;
case Types.JAVA_OBJECT:
case Types.OTHER:
case Types.BLOB:
......
......@@ -24,15 +24,13 @@ public class TestFullText extends TestBase {
return;
}
test(false, "VARCHAR");
int test;
test(false, "VARCHAR");
test(false, "CLOB");
testPerformance(false);
String luceneFullTextClassName = "org.h2.fulltext.FullTextLucene";
try {
Class.forName(luceneFullTextClassName);
test(true, "VARCHAR");
int test2;
test(true, "VARCHAR");
test(true, "CLOB");
testPerformance(true);
} catch (ClassNotFoundException e) {
println("Class not found, not tested: " + luceneFullTextClassName);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论