提交 7df59e43 authored 作者: Noel Grandin's avatar Noel Grandin

Merge pull request #236 from mbooth101/lucene_update

Move to latest version of lucene 3 and fix usages of deprecated APIs
......@@ -125,7 +125,7 @@ build jarClient
<h3>Using Apache Lucene</h3>
<p>
Apache Lucene 3.0.2 is used for testing.
Apache Lucene 3.6.2 is used for testing.
Newer versions may work, however they are not tested.
</p>
......
......@@ -1245,7 +1245,7 @@ org.h2.fulltext.FullText.searchData(conn, text, limit, offset);
<h3>Using the Apache Lucene Fulltext Search</h3>
<p>
To use the Apache Lucene full text search, you need the Lucene library in the classpath.
Currently, Apache Lucene 3.0.2 is used for testing.
Currently, Apache Lucene 3.6.2 is used for testing.
Newer versions may work, however they are not tested.
How to do that depends on the application; if you use the H2 Console, you can add the Lucene
jar file to the environment variables <code>H2DRIVERS</code> or
......
......@@ -1682,7 +1682,7 @@ javadocImpl
Using Apache Lucene
@build_1046_p
Apache Lucene 3.0.2 is used for testing. Newer versions may work, however they are not tested.
Apache Lucene 3.6.2 is used for testing. Newer versions may work, however they are not tested.
@build_1047_h2
Using Maven 2
......@@ -11966,7 +11966,7 @@ Using the Native Fulltext Search
Using the Apache Lucene Fulltext Search
@tutorial_1311_p
To use the Apache Lucene full text search, you need the Lucene library in the classpath. Currently, Apache Lucene 3.0.2 is used for testing. Newer versions may work, however they are not tested. How to do that depends on the application; if you use the H2 Console, you can add the Lucene jar file to the environment variables <code>H2DRIVERS</code> or <code>CLASSPATH</code>. To initialize the Lucene fulltext search in a database, call:
To use the Apache Lucene full text search, you need the Lucene library in the classpath. Currently, Apache Lucene 3.6.2 is used for testing. Newer versions may work, however they are not tested. How to do that depends on the application; if you use the H2 Console, you can add the Lucene jar file to the environment variables <code>H2DRIVERS</code> or <code>CLASSPATH</code>. To initialize the Lucene fulltext search in a database, call:
@tutorial_1312_p
You need to initialize it in each database where you want to use it. Afterwards, you can create a full text index for a table using:
......
......@@ -1682,7 +1682,7 @@ SSL/TLS
#Using Apache Lucene
@build_1046_p
# Apache Lucene 3.0.2 is used for testing. Newer versions may work, however they are not tested.
# Apache Lucene 3.6.2 is used for testing. Newer versions may work, however they are not tested.
@build_1047_h2
Maven 2 �?�利用
......@@ -11966,7 +11966,7 @@ Java Web Start / JNLP
#Using the Apache Lucene Fulltext Search #Luceneフルテキストサー�?を使用�?�る
@tutorial_1311_p
# To use the Apache Lucene full text search, you need the Lucene library in the classpath. Currently, Apache Lucene 3.0.2 is used for testing. Newer versions may work, however they are not tested. How to do that depends on the application; if you use the H2 Console, you can add the Lucene jar file to the environment variables <code>H2DRIVERS</code> or <code>CLASSPATH</code>. To initialize the Lucene fulltext search in a database, call:
# To use the Apache Lucene full text search, you need the Lucene library in the classpath. Currently, Apache Lucene 3.6.2 is used for testing. Newer versions may work, however they are not tested. How to do that depends on the application; if you use the H2 Console, you can add the Lucene jar file to the environment variables <code>H2DRIVERS</code> or <code>CLASSPATH</code>. To initialize the Lucene fulltext search in a database, call:
@tutorial_1312_p
# You need to initialize it in each database where you want to use it. Afterwards, you can create a full text index for a table using:
......
......@@ -559,7 +559,7 @@ build_1042_code=javadocImpl
build_1043_li=\ creates the Javadocs of the implementation.
build_1044_p=\ To create the file <code>h2client.jar</code>, go to the directory <code>h2</code> and execute the following command\:
build_1045_h3=Using Apache Lucene
build_1046_p=\ Apache Lucene 3.0.2 is used for testing. Newer versions may work, however they are not tested.
build_1046_p=\ Apache Lucene 3.6.2 is used for testing. Newer versions may work, however they are not tested.
build_1047_h2=Using Maven 2
build_1048_h3=Using a Central Repository
build_1049_p=\ You can include the database in your Maven 2 project as a dependency. Example\:
......@@ -3987,7 +3987,7 @@ tutorial_1307_p=\ To drop an index on a table\:
tutorial_1308_p=\ To get the raw data, use <code>FT_SEARCH_DATA('Hello', 0, 0);</code>. The result contains the columns <code>SCHEMA</code> (the schema name), <code>TABLE</code> (the table name), <code>COLUMNS</code> (an array of column names), and <code>KEYS</code> (an array of objects). To join a table, use a join as in\: <code>SELECT T.* FROM FT_SEARCH_DATA('Hello', 0, 0) FT, TEST T WHERE FT.TABLE\='TEST' AND T.ID\=FT.KEYS[0];</code>
tutorial_1309_p=\ You can also call the index from within a Java application\:
tutorial_1310_h3=Using the Apache Lucene Fulltext Search
tutorial_1311_p=\ To use the Apache Lucene full text search, you need the Lucene library in the classpath. Currently, Apache Lucene 3.0.2 is used for testing. Newer versions may work, however they are not tested. How to do that depends on the application; if you use the H2 Console, you can add the Lucene jar file to the environment variables <code>H2DRIVERS</code> or <code>CLASSPATH</code>. To initialize the Lucene fulltext search in a database, call\:
tutorial_1311_p=\ To use the Apache Lucene full text search, you need the Lucene library in the classpath. Currently, Apache Lucene 3.6.2 is used for testing. Newer versions may work, however they are not tested. How to do that depends on the application; if you use the H2 Console, you can add the Lucene jar file to the environment variables <code>H2DRIVERS</code> or <code>CLASSPATH</code>. To initialize the Lucene fulltext search in a database, call\:
tutorial_1312_p=\ You need to initialize it in each database where you want to use it. Afterwards, you can create a full text index for a table using\:
tutorial_1313_p=\ PUBLIC is the schema name, TEST is the table name. The list of column names (comma separated) is optional, in this case all columns are indexed. The index is updated in realtime. To search the index, use the following query\:
tutorial_1314_p=\ This will produce a result set that contains the query needed to retrieve the data\:
......
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论