Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
5c4719de
Unverified
提交
5c4719de
authored
6 年前
作者:
Evgenij Ryazanov
提交者:
GitHub
6 年前
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1538 from katzyn/lucene
Add support for newer Lucene versions without recompilation
上级
07a263a5
ee1c8fd2
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
25 行增加
和
12 行删除
+25
-12
build.html
h2/src/docsrc/html/build.html
+1
-1
tutorial.html
h2/src/docsrc/html/tutorial.html
+2
-2
MANIFEST.MF
h2/src/main/META-INF/MANIFEST.MF
+8
-8
FullTextLucene.java
h2/src/main/org/h2/fulltext/FullTextLucene.java
+14
-1
没有找到文件。
h2/src/docsrc/html/build.html
浏览文件 @
5c4719de
...
...
@@ -116,7 +116,7 @@ build jarClient
<h3>
Using Apache Lucene
</h3>
<p>
Apache Lucene 5.5.5 is used for testing.
Newer versions
may work, 7.5.0 was tested with recompiled under JDK 8 version
.
Newer versions
up to 7.5.0 can also be used
.
</p>
<h2
id=
"maven2"
>
Using Maven 2
</h2>
...
...
This diff is collapsed.
Click to expand it.
h2/src/docsrc/html/tutorial.html
浏览文件 @
5c4719de
...
...
@@ -1234,8 +1234,8 @@ 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 5.5.5 is used for testing
.
Newer versions may
work, 7.5.0 was tested with recompiled under JDK 8 version
.
Apache Lucene 5.5.5 or later version up to 7.5.0 is required
.
Newer versions may
also work, but were 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>
.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/META-INF/MANIFEST.MF
浏览文件 @
5c4719de
...
...
@@ -41,14 +41,14 @@ Import-Package: javax.crypto,
org.w3c.dom;resolution:=optional,
org.xml.sax;resolution:=optional,
org.xml.sax.helpers;resolution:=optional,
org.apache.lucene.analysis;version="[5.5.5,
6
.0.0)";resolution:=optional,
org.apache.lucene.analysis.standard;version="[5.5.5,
6
.0.0)";resolution:=optional,
org.apache.lucene.document;version="[5.5.5,
6
.0.0)";resolution:=optional,
org.apache.lucene.index;version="[5.5.5,
6
.0.0)";resolution:=optional,
org.apache.lucene.queryparser;version="[5.5.5,
6
.0.0)";resolution:=optional,
org.apache.lucene.search;version="[5.5.5,
6
.0.0)";resolution:=optional,
org.apache.lucene.store;version="[5.5.5,
6
.0.0)";resolution:=optional,
org.apache.lucene.util;version="[5.5.5,
6
.0.0)";resolution:=optional,
org.apache.lucene.analysis;version="[5.5.5,
8
.0.0)";resolution:=optional,
org.apache.lucene.analysis.standard;version="[5.5.5,
8
.0.0)";resolution:=optional,
org.apache.lucene.document;version="[5.5.5,
8
.0.0)";resolution:=optional,
org.apache.lucene.index;version="[5.5.5,
8
.0.0)";resolution:=optional,
org.apache.lucene.queryparser;version="[5.5.5,
8
.0.0)";resolution:=optional,
org.apache.lucene.search;version="[5.5.5,
8
.0.0)";resolution:=optional,
org.apache.lucene.store;version="[5.5.5,
8
.0.0)";resolution:=optional,
org.apache.lucene.util;version="[5.5.5,
8
.0.0)";resolution:=optional,
org.locationtech.jts.geom;version="1.15.0";resolution:=optional,
org.locationtech.jts.io;version="1.15.0";resolution:=optional,
org.osgi.framework;version="1.5",
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/fulltext/FullTextLucene.java
浏览文件 @
5c4719de
...
...
@@ -38,11 +38,13 @@ import org.apache.lucene.search.TopDocs;
import
org.apache.lucene.store.Directory
;
import
org.apache.lucene.store.FSDirectory
;
import
org.apache.lucene.store.RAMDirectory
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.Trigger
;
import
org.h2.command.Parser
;
import
org.h2.engine.Session
;
import
org.h2.expression.ExpressionColumn
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.message.DbException
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.util.StatementBuilder
;
...
...
@@ -75,6 +77,17 @@ public class FullTextLucene extends FullText {
*/
private
static
final
String
IN_MEMORY_PREFIX
=
"mem:"
;
private
static
final
java
.
lang
.
reflect
.
Field
TOTAL_HITS
;
static
{
try
{
TOTAL_HITS
=
TopDocs
.
class
.
getField
(
"totalHits"
);
}
catch
(
ReflectiveOperationException
e
)
{
throw
DbException
.
get
(
ErrorCode
.
GENERAL_ERROR_1
,
e
,
"Field org.apache.lucene.search.TopDocs.totalHits is not found"
);
}
}
/**
* Initializes full text search functionality for this database. This adds
* the following Java functions to the database:
...
...
@@ -434,7 +447,7 @@ public class FullTextLucene extends FullText {
// TopDocs.totalHits is long now
// (https://issues.apache.org/jira/browse/LUCENE-7872)
// but in this context it's safe to cast
limit
=
(
int
)
docs
.
totalHits
;
limit
=
(
int
)
TOTAL_HITS
.
getLong
(
docs
)
;
}
for
(
int
i
=
0
,
len
=
docs
.
scoreDocs
.
length
;
i
<
limit
&&
i
+
offset
<
docs
.
totalHits
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论