问题
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''
- Why am i not able to query with [oak:Unstructured], when this is declared nodeType
- How do i verify if i am able to leverage the lucene index created?
Thanks
回答1:
Why am i not able to query with [oak:Unstructured], when this is declared nodeType
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.
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();
来源:https://stackoverflow.com/questions/32457605/jcr-oak-query-nodetype