JCR OAK查询和节点类型 [英] JCR OAK Query & NodeType

查看:124
本文介绍了JCR OAK查询和节点类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究Apache JackRabbit OAK(1.3.2). 我已创建具有以下结构的节点(MyNode),并将其保存在存储库中.
-'jcr:primaryType'=橡木:非结构化
-'name'='myNode'
我还根据文档. 但是,当我运行以下查询时,我没有任何结果.
select * from [oak:Unstructured] where name='myNode'
当运行以下查询时,我得到保存的"MyNode"结果
'从[nt:base]中选择*,其中[jcr:primaryType] ='oak:Unstructured'和name ='myNode'

I am working on Apache JackRabbit OAK (1.3.2). I have created a node (MyNode) with the following structure and saved in the repository.
-- 'jcr:primaryType'=oak:Unstructured
-- 'name'='myNode'
I also created a lucene index to index all the properties as per the documentation. However when i run the following query i get no results.
select * from [oak:Unstructured] where name='myNode'
And when the run the following query i get the saved 'MyNode' in result
'select * from [nt:base] where [jcr:primaryType]='oak:Unstructured' and name='myNode''

  1. 当声明为nodeType时,为什么不能使用[oak:Unstructured]查询
  2. 如何验证我是否能够利用创建的lucene索引?


谢谢

推荐答案

当声明为nodeType时,为什么不能使用[oak:Unstructured]查询

Why am i not able to query with [oak:Unstructured], when this is declared nodeType

我无法查询的原因是在创建节点期间,仅将属性'jcr:primaryType'设置为'oak:Unstructured'是不够的.我们需要将该属性的类型显式设置为"NAME",否则将被视为"STRING"属性.

The reason I was not able to query was during the creation of the node, just setting the property 'jcr:primaryType' to 'oak:Unstructured' is not enough. We need to set the type of this property to "NAME" explicitly, else it will be treated as a "STRING" property.

如何验证我是否能够利用创建的lucene索引?

How do i verify if i am able to leverage the lucene index created?

仅创建索引节点将无法满足索引的需要,我们还需要使用索引来初始化存储库.我使用以下行在存储库中启用索引.

Just creating the index node will not satisfy for indexing, we also need to initialize the repository with indexing. I used the following line to enable indexing in my repository.

      jcr.withAsyncIndexing();

这篇关于JCR OAK查询和节点类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆