I have configured an empty repository with the following setup;

            segmentStore = new FileStore(new File(oakRepositoryPath), 256);
            NodeStore nodeStore = new SegmentNodeStore(segmentStore);

            Oak oak = new Oak(nodeStore);

            LuceneIndexProvider provider = new LuceneIndexProvider();
            oakRepository = new Jcr(oak)
                    .with(new LocalInitialContent())
                    .with((QueryIndexProvider) provider)
                    .with((Observer) provider)
                    .with(new LuceneIndexEditorProvider())
                    .with(new LuceneInitializerHelper("lucene",
(Set<String>) null))
                    .withAsyncIndexing()
                    .createRepository();

The lucene index is configured in the LocalInitialContent class using;

    @Override
    public void initialize(NodeBuilder builder) {

        NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder);
        index.child("lucene")
            .setProperty("jcr:primaryType",
"oak:QueryIndexDefinition", Type.NAME)
            .setProperty("type", "lucene")
            .setProperty("async", "async")
            .setProperty(PropertyStates.createProperty("includePropertyTypes",
ImmutableSet.of(PropertyType.TYPENAME_STRING,
PropertyType.TYPENAME_BINARY), Type.STRINGS))
            .setProperty(PropertyStates.createProperty("excludePropertyNames",
ImmutableSet.of("jcr:createdBy", "jcr:lastModifiedBy"), Type.STRINGS))
            .setProperty("reindex", true);
    }

Now, when I start up my app, I get the following relevant log entries;

20:16:48,314 DEBUG repository.RepositoryService.afterPropertiesSet() -
line 105 [] - creating repository
20:16:48,923 INFO  index.IndexUpdate.shouldReindex() - line 145 [] -
Found a new index node [reference]. Reindexing is requested
20:16:48,925 INFO  index.IndexUpdate.enter() - line 110 [] -
Reindexing will be performed for following indexes: [/oak:index/uuid,
/oak:index/reference, /oak:index/nodetype]
20:16:49,167 DEBUG action.AccessControlAction.setAC() - line 150 [] -
System user: admin; omit ac setup.
20:16:49,168 DEBUG user.UserManagerImpl.createUser() - line 167 [] -
User created: admin
20:16:49,171 DEBUG action.AccessControlAction.setAC() - line 150 [] -
System user: anonymous; omit ac setup.
20:16:49,173 DEBUG user.UserManagerImpl.createUser() - line 167 [] -
User created: anonymous
20:16:49,218 INFO  index.IndexUpdate.enter() - line 110 [] -
Reindexing will be performed for following indexes:
[/oak:index/principalName, /oak:index/acPrincipalName,
/oak:index/authorizableId]
[...]
20:16:54,055 DEBUG index.AsyncIndexUpdate.run() - line 261 [] -
Running background index task async
20:16:54,057 INFO  index.AsyncIndexUpdate.run() - line 294 [] -
Initial async index update
20:16:54,085 INFO  index.IndexUpdate.shouldReindex() - line 145 [] -
Found a new index node [counter]. Reindexing is requested
20:16:54,204 INFO  lucene.IndexDefinition.updateDefinition() - line
884 [] - Updated index definition for <No 'name' property defined>
20:16:54,205 INFO  index.IndexUpdate.enter() - line 110 [] -
Reindexing will be performed for following indexes:
[/oak:index/counter, /oak:index/lucene]

I then add some content, among them a node of type ka:asset
(oak:Unstructured) with the title Torgeir Veimo, which I then search
for;

20:27:46,389 DEBUG query.QueryEngineImpl.parseQuery() - line 107
[0:0:0:0:0:0:0:1] - Parsing JCR-SQL2 statement: select * from
[ka:asset] where contains(*, 'torgeir')
20:27:46,390 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost using filter Filter(query=select * from
[ka:asset] where contains(*, 'torgeir') fullText="torgeir", path=*)
20:27:46,390 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for reference is Infinity
20:27:46,390 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for property is Infinity
20:27:46,390 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for ordered is Infinity
20:27:46,391 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for nodeType is Infinity
20:27:46,392 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for aggregate lucene is Infinity
20:27:46,393 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for lucene-property is Infinity
20:27:46,393 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for traverse is Infinity
20:27:46,393 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - query execute select * from [ka:asset] where
contains(*, 'torgeir')
20:27:46,394 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - query plan [ka:asset] as [ka:asset] /* traverse
"*" where contains([ka:asset].[*], 'torgeir') */
20:27:46,399 WARN  query.Cursors$TraversingCursor.fetchNext() - line
312 [0:0:0:0:0:0:0:1] - Traversed 1000 nodes with filter
Filter(query=select * from [ka:asset] where contains(*, 'torgeir')
fullText="torgeir", path=*); consider creating an index or changing
the query
20:27:46,401 DEBUG repository.RepositoryAdminService.toNodeObjects() -
line 218 [0:0:0:0:0:0:0:1] - loading: 0, pageSize: 100, totalCount: 0
assets took 0ms

If I query for nt:base instead, I don't get the "traversed 1000
nodes..", but there's no results then either

20:28:33,809 DEBUG repository.RepositoryAdminService.query() - line
155 [0:0:0:0:0:0:0:1] - searching for: select * from [nt:base] where
contains(*, 'torgeir')
20:28:33,810 DEBUG query.QueryEngineImpl.parseQuery() - line 107
[0:0:0:0:0:0:0:1] - Parsing JCR-SQL2 statement: select * from
[nt:base] where contains(*, 'torgeir')
20:28:33,810 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost using filter Filter(query=select * from
[nt:base] where contains(*, 'torgeir') fullText="torgeir", path=*)
20:28:33,810 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for reference is Infinity
20:28:33,810 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for property is Infinity
20:28:33,811 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for ordered is Infinity
20:28:33,811 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for nodeType is Infinity
20:28:33,811 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for aggregate lucene is Infinity
20:28:33,812 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for lucene-property is Infinity
20:28:33,812 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - cost for traverse is Infinity
20:28:33,812 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - query execute select * from [nt:base] where
contains(*, 'torgeir')
20:28:33,813 DEBUG query.QueryImpl.logDebug() - line 894
[0:0:0:0:0:0:0:1] - query plan [nt:base] as [nt:base] /* traverse "*"
where contains([nt:base].[*], 'torgeir') */
20:28:33,813 DEBUG repository.RepositoryAdminService.toNodeObjects() -
line 218 [0:0:0:0:0:0:0:1] - loading: 0, pageSize: 100, totalCount: 0
assets took 0ms


I have also tried setting up the luene index more in line with the new
examples at http://jackrabbit.apache.org/oak/docs/query/lucene.html,
here in LocalInitialContent;

        NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder);
        index.child("lucene")
            .setProperty("jcr:primaryType",
"oak:QueryIndexDefinition", Type.NAME)
            .setProperty("compatVersion", "2")
            .setProperty("type", "lucene")
            .setProperty("async", "async")
            .setProperty("reindex", true)
            .child("indexRules")
                .setProperty("jcr:primaryType", "oak:Unstructured", Type.NAME)
                .child("nt:base")
                    .setProperty("jcr:primaryType",
"oak:Unstructured", Type.NAME)
                    .child("properties")
                        .setProperty("jcr:primaryType",
"oak:Unstructured", Type.NAME)
                        .child("allProps")
                            .setProperty("jcr:primaryType",
"oak:Unstructured", Type.NAME)
                            .setProperty("name", ".*")
                            .setProperty("isRegEx", true)
                            .setProperty("nodeScopeIndex", true);
        index.child("lucene")
            .child("indexRules")
                .child("ka:asset")
                    .setProperty("jcr:primaryType",
"oak:Unstructured", Type.NAME)
                    .child("properties")
                        .setProperty("jcr:primaryType",
"oak:Unstructured", Type.NAME)
                        .child("allProps")
                            .setProperty("jcr:primaryType",
"oak:Unstructured", Type.NAME)
                            .setProperty("name", ".*")
                            .setProperty("isRegEx", true)
                            .setProperty("nodeScopeIndex", true);


but then I get these messages in the log, repeatedly;

20:41:42,024 WARN  lucene.IndexDefinition.collectIndexRules() - line
505 [] - IndexRule node does not have orderable children in [Lucene
Index : /oak:index/lucene]
20:41:42,027 WARN
lucene.IndexDefinition$IndexingRule.collectPropConfigs() - line 730 []
- Properties node for [IndexRule: ka:asset] does not have orderable
children in [Lucene Index : /oak:index/lucene]
20:41:42,031 WARN
lucene.IndexDefinition$IndexingRule.collectPropConfigs() - line 730 []
- Properties node for [IndexRule: nt:base] does not have orderable
children in [Lucene Index : /oak:index/lucene]

so I assume this configuration is not correct. Any pointers to what I
need to change?



On 11 February 2015 at 20:11, Torgeir Veimo <torgeir.ve...@gmail.com> wrote:
> Is there a way to trigger full reindex? Can I just set the reindex
> property on the index definition to true?
>
> On 11 February 2015 at 18:17, Thomas Mueller <muel...@adobe.com> wrote:
>> Hi,
>>
>> This should work (full-text queries work for me). Maybe you need to wait
>> for the Lucene index to be updated (it is asynchronous)? Maybe you want to
>> double-check with the documentation at
>> http://jackrabbit.apache.org/oak/docs/query/lucene.html
>>
>> Regards,
>> Thomas
>>
>>
>>
>>
>> On 10/02/15 14:59, "Torgeir Veimo" <torgeir.ve...@gmail.com> wrote:
>>
>>>My lucene full-text index is configured as per examples as;
>>>
>>>        NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder);
>>>        index.child("lucene")
>>>                .setProperty("jcr:primaryType",
>>>"oak:QueryIndexDefinition", Type.NAME)
>>>                .setProperty("type", "lucene")
>>>                .setProperty("async", "async")
>>>
>>>.setProperty(PropertyStates.createProperty("includePropertyTypes",
>>>ImmutableSet.of(PropertyType.TYPENAME_STRING,
>>>PropertyType.TYPENAME_BINARY), Type.STRINGS))
>>>
>>>.setProperty(PropertyStates.createProperty("excludePropertyNames",
>>>ImmutableSet.of("jcr:createdBy", "jcr:lastModifiedBy"), Type.STRINGS))
>>>                .setProperty("reindex", true);
>>>
>>>But it doesn't provide any results. From my understanding, this
>>>definition will index any STRING and BINARY property type,
>>>
>>>Trying a query like //*[jcr:contains(., 'test')] doesn't work, even
>>>though I've got nodes with test in string properties.
>>>
>>>--
>>>-Tor
>>
>
>
>
> --
> -Tor



-- 
-Tor

Reply via email to