Thank you! This example helped me iron out the errors in my index configuration!

It would be good to have a bit more example code online for these things.

On 6 March 2015 at 04:16, Chetan Mehrotra <[email protected]> wrote:
> Hi Torgeir,
>
> Sorry for the delay here as got stuck with other issues. I tried your
> approach and it looks like you had a typo in your index defintion
>
> -  .setProperty("isRegExp", true)
> +  .setProperty("isRegexp", true)
>   .setProperty("nodeScopeIndex", true);
>
> I tried to create a standalone example which you can give a try to see
> lucene index in action [1]
>
> Let me know if you still face any issue
>
> Chetan Mehrotra
> [1] https://gist.github.com/chetanmeh/c1ccc4fa588ed1af467b
>
>
> On Wed, Feb 25, 2015 at 7:26 PM, Torgeir Veimo <[email protected]> 
> wrote:
>> Sorted out my lucene version issues, so not getting that exception any
>> more, but still not getting any query results. Still seeing multiple
>> of these in the logs;
>>
>> 23:55:14,288 TRACE lucene.IndexDefinition.collectIndexRules() - line
>> 519 [0:0:0:0:0:0:0:1] - Found rule 'IndexRule: ka:asset' for NodeType
>> 'ka:asset'
>> 23:55:14,288 TRACE lucene.IndexDefinition.collectIndexRules() - line
>> 535 [0:0:0:0:0:0:0:1] - Registering rule 'IndexRule: ka:asset' for
>> name 'ka:asset'
>>
>> On 25 February 2015 at 16:49, Torgeir Veimo <[email protected]> wrote:
>>> I tried without the async: async property on the lucene index, on an
>>> empty repository, and am seeing an exception.
>>>
>>> Any idea on how I can try to find the cause of this?
>>>
>>> I assume if I tried to run with the lucene index on disk instead of in
>>> the segment store, I might avoid this, but the documentation doesn't
>>> really outline how to do this in much detail.
>>>
>>> 16:44:09,437 INFO  index.IndexUpdate.enter() - line 110 [] -
>>> Reindexing will be performed for following indexes:
>>> [/oak:index/ka:owner, /oak:index/positionref, /oak:index/targetId,
>>> /oak:index/uuid, /oak:index/ka:id, /oak:index/mail,
>>> /oak:index/ka:tags, /oak:index/active, /oak:index/ka:applicationState,
>>> /oak:index/parentTargetId, /oak:index/reference, /oak:index/ka:uid,
>>> /oak:index/ka:rememberme, /oak:index/ka:state, /oak:index/ka:serial,
>>> /oak:index/ka:assetType, /oak:index/lucene, /oak:index/ka:series,
>>> /oak:index/ka:principal, /oak:index/affiliation, /oak:index/ka:expire,
>>> /oak:index/companyref, /oak:index/title, /oak:index/lastCommentDate,
>>> /oak:index/ka:subscriptionFrequency, /oak:index/nodetype]
>>> 16:44:09,547 WARN  support.AbstractApplicationContext.refresh() - line
>>> 486 [] - Exception encountered during context initialization -
>>> cancelling refresh attempt
>>> org.springframework.beans.factory.BeanCreationException: Error
>>> creating bean with name 'assetOwnerPermission': Injection of autowired
>>> dependencies failed; nested exception is
>>> org.springframework.beans.factory.BeanCreationException: Could not
>>> autowire field: no.karriere.content.dao.AssetRepository
>>> no.karriere.content.authorization.permissions.AbstractPermission.assetRepository;
>>> nested exception is
>>> org.springframework.beans.factory.BeanCreationException: Error
>>> creating bean with name 'assetRepository': Injection of autowired
>>> dependencies failed; nested exception is
>>> org.springframework.beans.factory.BeanCreationException: Could not
>>> autowire field: no.karriere.content.dao.jcr.MediaHelper
>>> no.karriere.content.dao.jcr.JcrAssetRepository.mediaHelper; nested
>>> exception is org.springframework.beans.factory.BeanCreationException:
>>> Error creating bean with name 'mediaHelper': Injection of autowired
>>> dependencies failed; nested exception is
>>> org.springframework.beans.factory.BeanCreationException: Could not
>>> autowire field:
>>> no.karriere.content.services.repository.RepositoryService
>>> no.karriere.content.dao.jcr.MediaHelper.repositoryService; nested
>>> exception is org.springframework.beans.factory.BeanCreationException:
>>> Error creating bean with name 'repositoryService': Injection of
>>> autowired dependencies failed; nested exception is
>>> org.springframework.beans.factory.BeanCreationException: Could not
>>> autowire field: javax.jcr.Repository
>>> no.karriere.content.services.repository.RepositoryService.oakRepository;
>>> nested exception is
>>> org.springframework.beans.factory.BeanCreationException: Error
>>> creating bean with name 'getRepository' defined in class path resource
>>> [no/karriere/content/dao/jcr/repository/RepositoryConfiguration.class]:
>>> Instantiation of bean failed; nested exception is
>>> org.springframework.beans.factory.BeanDefinitionStoreException:
>>> Factory method [public javax.jcr.Repository
>>> no.karriere.content.dao.jcr.repository.RepositoryConfiguration.getRepository()
>>> throws no.karriere.content.exception.ContentException] threw
>>> exception; nested exception is java.lang.AbstractMethodError:
>>> org.apache.lucene.store.IndexOutput.getChecksum()J
>>> at 
>>> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:298)
>>> at 
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1148)
>>> at 
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>>> at 
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
>>>
>>> [.... lots of nested spring stuff]
>>>
>>> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
>>> Factory method [public javax.jcr.Repository
>>> no.karriere.content.dao.jcr.repository.RepositoryConfiguration.getRepository()
>>> throws no.karriere.content.exception.ContentException] threw
>>> exception; nested exception is java.lang.AbstractMethodError:
>>> org.apache.lucene.store.IndexOutput.getChecksum()J
>>> at 
>>> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:181)
>>> at 
>>> org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:592)
>>>
>>> ... 79 more
>>>
>>>
>>> Caused by: java.lang.AbstractMethodError:
>>> org.apache.lucene.store.IndexOutput.getChecksum()J
>>> at org.apache.lucene.codecs.CodecUtil.writeFooter(CodecUtil.java:186)
>>> at org.apache.lucene.index.SegmentInfos.finishCommit(SegmentInfos.java:1054)
>>> at org.apache.lucene.index.IndexWriter.finishCommit(IndexWriter.java:3130)
>>> at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:3111)
>>> at org.apache.lucene.index.IndexWriter.shutdown(IndexWriter.java:913)
>>> at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:984)
>>> at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:954)
>>> at 
>>> org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext.closeWriter(LuceneIndexEditorContext.java:151)
>>> at 
>>> org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditor.leave(LuceneIndexEditor.java:191)
>>> at 
>>> org.apache.jackrabbit.oak.spi.commit.CompositeEditor.leave(CompositeEditor.java:74)
>>> at 
>>> org.apache.jackrabbit.oak.spi.commit.VisibleEditor.leave(VisibleEditor.java:63)
>>> at 
>>> org.apache.jackrabbit.oak.spi.commit.EditorDiff.process(EditorDiff.java:56)
>>> at 
>>> org.apache.jackrabbit.oak.plugins.index.IndexUpdate.enter(IndexUpdate.java:116)
>>> at 
>>> org.apache.jackrabbit.oak.spi.commit.VisibleEditor.enter(VisibleEditor.java:57)
>>> at 
>>> org.apache.jackrabbit.oak.spi.commit.EditorDiff.process(EditorDiff.java:49)
>>> at 
>>> org.apache.jackrabbit.oak.spi.commit.EditorHook.processCommit(EditorHook.java:54)
>>> at 
>>> org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore$Commit.prepare(SegmentNodeStore.java:397)
>>> at 
>>> org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore$Commit.optimisticMerge(SegmentNodeStore.java:428)
>>> at 
>>> org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore$Commit.execute(SegmentNodeStore.java:484)
>>> at 
>>> org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore.merge(SegmentNodeStore.java:162)
>>> at 
>>> org.apache.jackrabbit.oak.spi.lifecycle.OakInitializer.initialize(OakInitializer.java:45)
>>> at org.apache.jackrabbit.oak.Oak.createContentRepository(Oak.java:518)
>>> at org.apache.jackrabbit.oak.jcr.Jcr.createRepository(Jcr.java:202)
>>> at 
>>> no.karriere.content.dao.jcr.repository.RepositoryConfiguration.getRepository(RepositoryConfiguration.java:93)
>>>
>>>
>>>
>>>
>>> On 25 February 2015 at 16:41, Torgeir Veimo <[email protected]> wrote:
>>>> Thank you for your reply!
>>>>
>>>> Setting the :childOrder helps reduce the warning logs. I am still
>>>> getting these log entries a lot;
>>>>
>>>> 16:38:00,016 TRACE lucene.IndexDefinition.collectIndexRules() - line
>>>> 519 [] - Found rule 'IndexRule: ka:asset' for NodeType 'ka:asset'
>>>> 16:38:00,016 TRACE lucene.IndexDefinition.collectIndexRules() - line
>>>> 535 [] - Registering rule 'IndexRule: ka:asset' for name 'ka:asset'
>>>>
>>>> I am unsure why these keeps getting repeated, could it be that the
>>>> index configuration fails, and retries the next time I make a query?
>>>>
>>>> I am now using this code to configure;
>>>>
>>>> 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(":childOrder", ImmutableSet.of("ka:asset"), Type.STRINGS)
>>>>         .child("ka:asset")
>>>>             .setProperty("jcr:primaryType", "nt:unstructured", Type.NAME)
>>>>             .child("properties")
>>>>                 .setProperty("jcr:primaryType", "nt:unstructured", 
>>>> Type.NAME)
>>>>                 .setProperty(":childOrder",
>>>> ImmutableSet.of("allProps"), Type.STRINGS)
>>>>                 .child("allProps")
>>>>                     .setProperty("jcr:primaryType", "nt:unstructured",
>>>> Type.NAME)
>>>>                     .setProperty("name", ".*")
>>>>                     .setProperty("isRegExp", true)
>>>>                     .setProperty("nodeScopeIndex", true);
>>>>
>>>> select * from [ka:asset] where lower(*) like '%admin%'
>>>>
>>>> yields two entries
>>>>
>>>> select * from [ka:asset] where contains(*,'admin')
>>>>
>>>> yields none.
>>>>
>>>> I am wondering if the setup of the repository is correct? I assume
>>>> that with the default LuceneIndexProvider() constructor, it will use
>>>> lucene indexes stored as segments in the segment store?
>>>>
>>>>
>>>> On 25 February 2015 at 10:46, Chetan Mehrotra <[email protected]> 
>>>> wrote:
>>>>> Hi Torgeir,
>>>>>
>>>>> By default the Lucene index would be updated every 5 sec. So are you
>>>>> performing query immediately after adding the content? If thats the
>>>>> case you can remove setting "async" property at least for your
>>>>> testcase to get Lucene index triggered immediately after commit
>>>>>
>>>>>> 21:58:51,075 WARN  lucene.IndexDefinition.collectIndexRules() - line
>>>>> 505 [0:0:0:0:0:0:0:1] - IndexRule node does not have orderable
>>>>> children in [Lucene Index : genericlucene(/oak:index/lucene)]
>>>>> 21:58:51,076 WARN
>>>>>
>>>>> You can create the index definition via JCR API. Basically the
>>>>> orderable children are detected via presence of ':childOrder' hidden
>>>>> property. When you set a nodetype to nt:unstructured then oak-jcr
>>>>> would set this property automatically to record the ordering. However
>>>>> if you do it via NodeStore API then that has to be done manually.
>>>>>
>>>>> Chetan Mehrotra
>>>>
>>>>
>>>>
>>>> --
>>>> -Tor
>>>
>>>
>>>
>>> --
>>> -Tor
>>
>>
>>
>> --
>> -Tor



-- 
-Tor

Reply via email to