提交 47b893d0 authored 作者: Thomas Mueller's avatar Thomas Mueller

Native fulltext search: before searching, FT_INIT() had to be called.

上级 50e52985
......@@ -108,10 +108,8 @@ public class FullText {
+ ".WORDS(ID INT AUTO_INCREMENT PRIMARY KEY, NAME VARCHAR, UNIQUE(NAME))");
stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA
+ ".ROWS(ID IDENTITY, HASH INT, INDEXID INT, KEY VARCHAR, UNIQUE(HASH, INDEXID, KEY))");
stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA
+ ".MAP(ROWID INT, WORDID INT, PRIMARY KEY(WORDID, ROWID))");
stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".IGNORELIST(LIST VARCHAR)");
stat.execute("CREATE ALIAS IF NOT EXISTS FT_CREATE_INDEX FOR \"" + FullText.class.getName() + ".createIndex\"");
stat.execute("CREATE ALIAS IF NOT EXISTS FT_DROP_INDEX FOR \"" + FullText.class.getName() + ".dropIndex\"");
......@@ -135,6 +133,7 @@ public class FullText {
map.put(word, id);
}
}
setting.setInitialized(true);
}
/**
......@@ -510,6 +509,9 @@ public class FullText {
return result;
}
FullTextSettings setting = FullTextSettings.getInstance(conn);
if (!setting.isInitialized()) {
init(conn);
}
HashSet<String> words = New.hashSet();
addWords(setting, words, text);
HashSet<Integer> rIds = null, lastRowIds = null;
......
......@@ -22,6 +22,7 @@ class FullTextSettings {
private static final HashMap<String, FullTextSettings> SETTINGS = New.hashMap();
private boolean initialized;
private HashSet<String> ignoreList = New.hashSet();
private HashMap<String, Integer> words = New.hashMap();
private HashMap<Integer, IndexInfo> indexes = New.hashMap();
......@@ -135,4 +136,12 @@ class FullTextSettings {
indexes.remove(index.id);
}
void setInitialized(boolean b) {
this.initialized = b;
}
boolean isInitialized() {
return initialized;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论