我正在文件节点存储中尝试使用 lucene 的 jackrabbit Oak。已成功创建索引定义记录,但似乎未创建索引记录。我正在做的完整项目在这里
我在代码中所做的是初始化一个存储库,创建 lucene 索引定义,添加一个带有单个属性“name”和值为“foo”的测试数据。休眠 5 秒以完成异步索引,然后在重试循环中执行以下查询 select * from [nt:base] where contains(., 'foo')。
不返回任何结果。我已经尝试过 Oak-run 控制台来检索 Oak:index/lucene 目录上的 lc 信息,它也没有显示任何结果。
这是代码的主要部分
public static void main( String[] args ) throws Exception
{
init();
createLuceneIndex();
createTestData();
performQuery();
}
private static void init() throws InvalidFileStoreVersionException, IOException {
LuceneIndexProvider provider = new LuceneIndexProvider();
FileStore fs = FileStoreBuilder.fileStoreBuilder(new File("repository")).build();
nodestore = SegmentNodeStoreBuilders.builder(fs).build();
repository = new Jcr(new Oak(nodestore))
.withAsyncIndexing("async", 3)
.with(new LuceneIndexEditorProvider())
.with((QueryIndexProvider) provider)
.with((Observer)provider)
.withAsyncIndexing()
.createRepository();
}
private static void …Run Code Online (Sandbox Code Playgroud)