I have recently been working on a Java JCR project with Jackrabbit Oak.
I am trying to implement fulltext search capabilities via lucene index, but I am having problems.
This is the lucene index I created:
/oak:index/lucene
- jcr:primaryType = "oak:QueryIndexDefinition"
- type = "lucene"
- compatVersion = 2
- async = "async"
+ indexRules
- jcr:primaryType = "nt:unstructured"
+ nt:base
+ properties
- jcr:primaryType = "nt:unstructured"
+ jcr:content
- name = "jcr:content"
- type = "String"
- propertyIndex = false
- analyzed = true
This is the Node I would like to search for
Node[NodeDelegate{tree=/home/test.txt: {
jcr:primaryType = nt:unstructured,
jcr:uuid = 1aa8c2a2-c06c-49f0-892d-96d40d78921b,
jcr:versionHistory = f1c33e1b-2d97-4e12-8fc0-cdb6881d08b8,
jcr:predecessors = [],
jcr:isCheckedOut = false,
jcr:mixinTypes = [mix:versionable],
jcr:baseVersion = 26d68547-e60a-44e5-a8e6-1aa04d1012d1,
jcr:content = {
jcr:primaryType = nt:resource,
jcr:uuid = fc2b91a3-9d6e-41a2-bc45-62945081c2db,
jcr:lastModifiedBy = admin,
jcr:data = {9 bytes},
jcr:mimeType = log,
cr:lastModified = 2021-03-09T14:33:41.933+01:00
}
}}]
The content (jcr:data) of file test.txt is:
test test
This is the query I use for the search
SELECT * FROM [nt:base] AS node WHERE CONTAINS([nt:base], 'test')
However, when I execute it, I don't get any results.
Why?