提交 69574cee authored 作者: Mat Booth's avatar Mat Booth

Move to latest version of lucene 3 and fix usages of deprecated

APIs.
上级 55e9b945
......@@ -23,14 +23,14 @@ Import-Package: javax.management,
javax.sql,
javax.tools;resolution:=optional,
javax.transaction.xa;resolution:=optional,
org.apache.lucene.analysis;version="[3.0.0,3.1.0)";resolution:=optional,
org.apache.lucene.analysis.standard;version="[3.0.0,3.1.0)";resolution:=optional,
org.apache.lucene.document;version="[3.0.0,3.1.0)";resolution:=optional,
org.apache.lucene.index;version="[3.0.0,3.1.0)";resolution:=optional,
org.apache.lucene.queryParser;version="[3.0.0,3.1.0)";resolution:=optional,
org.apache.lucene.search;version="[3.0.0,3.1.0)";resolution:=optional,
org.apache.lucene.store;version="[3.0.0,3.1.0)";resolution:=optional,
org.apache.lucene.util;version="[3.0.0,3.1.0)";resolution:=optional,
org.apache.lucene.analysis;version="[3.6.2,4.0.0)";resolution:=optional,
org.apache.lucene.analysis.standard;version="[3.6.2,4.0.0)";resolution:=optional,
org.apache.lucene.document;version="[3.6.2,4.0.0)";resolution:=optional,
org.apache.lucene.index;version="[3.6.2,4.0.0)";resolution:=optional,
org.apache.lucene.queryParser;version="[3.6.2,4.0.0)";resolution:=optional,
org.apache.lucene.search;version="[3.6.2,4.0.0)";resolution:=optional,
org.apache.lucene.store;version="[3.6.2,4.0.0)";resolution:=optional,
org.apache.lucene.util;version="[3.6.2,4.0.0)";resolution:=optional,
com.vividsolutions.jts.geom;version="1.14.0";resolution:=optional,
com.vividsolutions.jts.io;version="1.14.0";resolution:=optional,
org.h2;version="[${version},1.5.0)",
......
......@@ -20,11 +20,11 @@ import org.apache.lucene.document.DateTools;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Searcher;
import org.h2.api.Trigger;
import org.h2.command.Parser;
import org.h2.engine.Session;
......@@ -304,12 +304,12 @@ public class FullTextLucene extends FullText {
try {
Directory indexDir = path.startsWith(IN_MEMORY_PREFIX) ?
new RAMDirectory() : FSDirectory.open(new File(path));
boolean recreate = !IndexReader.indexExists(indexDir);
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30);
IndexWriter writer = new IndexWriter(indexDir, analyzer,
recreate, IndexWriter.MaxFieldLength.UNLIMITED);
IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_30, analyzer);
conf.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);
IndexWriter writer = new IndexWriter(indexDir, conf);
//see http://wiki.apache.org/lucene-java/NearRealtimeSearch
IndexReader reader = writer.getReader();
IndexReader reader = IndexReader.open(writer, true);
access = new IndexAccess();
access.writer = writer;
access.reader = reader;
......@@ -426,7 +426,7 @@ public class FullTextLucene extends FullText {
try {
IndexAccess access = getIndexAccess(conn);
// take a reference as the searcher may change
Searcher searcher = access.searcher;
IndexSearcher searcher = access.searcher;
// reuse the same analyzer; it's thread-safe;
// also allows subclasses to control the analyzer used.
Analyzer analyzer = access.writer.getAnalyzer();
......@@ -606,9 +606,8 @@ public class FullTextLucene extends FullText {
// recreate Searcher with the IndexWriter's reader.
indexAccess.searcher.close();
indexAccess.reader.close();
IndexReader reader = indexAccess.writer.getReader();
indexAccess.reader = reader;
indexAccess.searcher = new IndexSearcher(reader);
indexAccess.reader = IndexReader.open(indexAccess.writer, true);
indexAccess.searcher = new IndexSearcher(indexAccess.reader);
} catch (IOException e) {
throw convertException(e);
}
......@@ -715,7 +714,7 @@ public class FullTextLucene extends FullText {
/**
* The index searcher.
*/
Searcher searcher;
IndexSearcher searcher;
}
}
......@@ -121,7 +121,7 @@ public class Build extends BuildBase {
File.pathSeparator + "ext/emma-2.0.5312.jar" +
File.pathSeparator + "ext/postgresql-8.3-603.jdbc3.jar" +
File.pathSeparator + "ext/servlet-api-3.0.1.jar" +
File.pathSeparator + "ext/lucene-core-3.0.2.jar" +
File.pathSeparator + "ext/lucene-core-3.6.2.jar" +
File.pathSeparator + "ext/h2mig_pagestore_addon.jar" +
File.pathSeparator + "ext/org.osgi.core-4.2.0.jar" +
File.pathSeparator + "ext/org.osgi.enterprise-4.2.0.jar" +
......@@ -199,7 +199,7 @@ public class Build extends BuildBase {
download();
String classpath = "temp" +
File.pathSeparator + "ext/servlet-api-3.0.1.jar" +
File.pathSeparator + "ext/lucene-core-3.0.2.jar" +
File.pathSeparator + "ext/lucene-core-3.6.2.jar" +
File.pathSeparator + "ext/slf4j-api-1.6.0.jar" +
File.pathSeparator + "ext/org.osgi.core-4.2.0.jar" +
File.pathSeparator + "ext/org.osgi.enterprise-4.2.0.jar" +
......@@ -290,9 +290,9 @@ public class Build extends BuildBase {
downloadOrVerify("ext/servlet-api-3.0.1.jar",
"javax/servlet", "javax.servlet-api", "3.0.1",
"6bf0ebb7efd993e222fc1112377b5e92a13b38dd", offline);
downloadOrVerify("ext/lucene-core-3.0.2.jar",
"org/apache/lucene", "lucene-core", "3.0.2",
"c2b48995ab855c1b9ea13867a0f976c994e0105d", offline);
downloadOrVerify("ext/lucene-core-3.6.2.jar",
"org/apache/lucene", "lucene-core", "3.6.2",
"9ec77e2507f9cc01756964c71d91efd8154a8c47", offline);
downloadOrVerify("ext/slf4j-api-1.6.0.jar",
"org/slf4j", "slf4j-api", "1.6.0",
"b353147a7d51fcfcd818d8aa6784839783db0915", offline);
......@@ -575,7 +575,7 @@ public class Build extends BuildBase {
javadoc("-sourcepath", "src/main", "org.h2.jdbc", "org.h2.jdbcx",
"org.h2.tools", "org.h2.api", "org.h2.engine", "org.h2.fulltext",
"-classpath",
"ext/lucene-core-3.0.2.jar" +
"ext/lucene-core-3.6.2.jar" +
File.pathSeparator + "ext/jts-core-1.14.0.jar",
"-docletpath", "bin" + File.pathSeparator + "temp",
"-doclet", "org.h2.build.doclet.Doclet");
......@@ -598,7 +598,7 @@ public class Build extends BuildBase {
"/../lib/tools.jar" +
File.pathSeparator + "ext/slf4j-api-1.6.0.jar" +
File.pathSeparator + "ext/servlet-api-3.0.1.jar" +
File.pathSeparator + "ext/lucene-core-3.0.2.jar" +
File.pathSeparator + "ext/lucene-core-3.6.2.jar" +
File.pathSeparator + "ext/org.osgi.core-4.2.0.jar" +
File.pathSeparator + "ext/org.osgi.enterprise-4.2.0.jar" +
File.pathSeparator + "ext/jts-core-1.14.0.jar",
......@@ -614,7 +614,7 @@ public class Build extends BuildBase {
"/../lib/tools.jar" +
File.pathSeparator + "ext/slf4j-api-1.6.0.jar" +
File.pathSeparator + "ext/servlet-api-3.0.1.jar" +
File.pathSeparator + "ext/lucene-core-3.0.2.jar" +
File.pathSeparator + "ext/lucene-core-3.6.2.jar" +
File.pathSeparator + "ext/org.osgi.core-4.2.0.jar" +
File.pathSeparator + "ext/org.osgi.enterprise-4.2.0.jar" +
File.pathSeparator + "ext/jts-core-1.14.0.jar",
......@@ -630,7 +630,7 @@ public class Build extends BuildBase {
System.getProperty("java.home") + "/../lib/tools.jar" +
File.pathSeparator + "ext/slf4j-api-1.6.0.jar" +
File.pathSeparator + "ext/servlet-api-3.0.1.jar" +
File.pathSeparator + "ext/lucene-core-3.0.2.jar" +
File.pathSeparator + "ext/lucene-core-3.6.2.jar" +
File.pathSeparator + "ext/org.osgi.core-4.2.0.jar" +
File.pathSeparator + "ext/org.osgi.enterprise-4.2.0.jar" +
File.pathSeparator + "ext/jts-core-1.14.0.jar",
......@@ -846,7 +846,7 @@ public class Build extends BuildBase {
java("org.h2.build.doc.GenerateHelp", null);
javadoc("-sourcepath", "src/main", "org.h2.tools", "org.h2.jmx",
"-classpath",
"ext/lucene-core-3.0.2.jar" +
"ext/lucene-core-3.6.2.jar" +
File.pathSeparator + "ext/jts-core-1.14.0.jar",
"-docletpath", "bin" + File.pathSeparator + "temp",
"-doclet", "org.h2.build.doclet.ResourceDoclet");
......@@ -893,7 +893,7 @@ public class Build extends BuildBase {
String cp = "temp" + File.pathSeparator + "bin" +
File.pathSeparator + "ext/postgresql-8.3-603.jdbc3.jar" +
File.pathSeparator + "ext/servlet-api-3.0.1.jar" +
File.pathSeparator + "ext/lucene-core-3.0.2.jar" +
File.pathSeparator + "ext/lucene-core-3.6.2.jar" +
File.pathSeparator + "ext/h2mig_pagestore_addon.jar" +
File.pathSeparator + "ext/org.osgi.core-4.2.0.jar" +
File.pathSeparator + "ext/org.osgi.enterprise-4.2.0.jar" +
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论