Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Seeing intemittent issue for one of the newly created custom index in local

Avatar

Level 4

Hi

we see few warnings in logs for queries so I have created custom index for those and it's working fine. Only for one index I am seeing intermittent issue.

when I tried to do query performance with below query index name is not showing sometimes if I do reindex sometimes it is showing and sometimes it is not showing.

can we create index without index rules ?

I have tried to create in the below case but afterd deployment apps packageis not installed so I have added like below.

Can we create empty index rules for index with out property ?

Generally in which case we will add reidex to true ?

 

select [jcr:path], [jcr:score], * from [sling:Message] as a where isdescendantnode(a, '/apps/test/i18n/page/en')

 

compatVersion = 2
- async = "async"
- queryPaths = [/apps/test/i18n/page/en]
- includedPaths = [/apps/test/i18n/page/en]
- jcr:primaryType = oak:QueryIndexDefinition
- evaluatePathRestrictions = true
- type = "lucene"
+ indexRules
+ sling:Message
+ properties
+ SHOULD_ADD_PROPERTY_CONSTRAINT
- name = "SHOULD_ADD_PROPERTY_CONSTRAINT"

<i18Index
jcr:primaryType="oak:QueryIndexDefinition"
async="[async,nrt]"
compatVersion="2"
evaluatePathRestrictions="{Boolean}true"
includedPaths="[/apps/test/i18n]"
queryPaths="[/apps/test/i18n]"
reindex="{Boolean}false"
reindexCount="{Long}1"
seed="{Long}8698841245336077431"
type="lucene">
<indexRules jcr:primaryType="nt:unstructured">
</indexRules>
</i18Index>

 

5 Replies

Avatar

Community Advisor

Hi @vijitha ,

When you set the "reindex" true does it automatically change to true after indexing. Once manual reindexing is done reindexCount should increase.
If that is not happening then there is something wrong in your query or local environment. Please check it in any other environment or fresh AEM instance.


Thanks
Tarun

Avatar

Level 4

Hi @TarunKumar 

Ya after reindexing I see count is getting increased. 

 

Avatar

Community Advisor

Hi @vijitha 

  1. Can we create an index without index rules? 
    Yes, it is possible to create an index without index rules. However, index rules are typically used to define the properties and constraints for the index, so it is recommended to include them for better query performance.

  2. Can we create empty index rules for an index without properties? 
    Yes, you can create empty index rules for an index without properties. However, keep in mind that without any properties defined in the index rules, the index may not be useful for querying.

  3. In which case do we add reindex to true? The reindex property is used to indicate whether the index should be reindexed. Setting it to true means that the index will be rebuilt from scratch. You would typically set reindex to true when you want to rebuild the index due to changes in the data or index configuration.



Avatar

Level 4

Hi @Raja_Reddy 

Thank you for your response. I have created custom index for below query and when I tried to execute query in queryperformance tool index name is not showing. Please correct me if I am wrong.

select [jcr:path], [jcr:score], * from [sling:Message] as a where isdescendantnode(a, '/apps/test/i18n/page/en')

 

compatVersion = 2
- async = "async"
- queryPaths = [/apps/test/i18n/page/en]
- includedPaths = [/apps/test/i18n/page/en]
- jcr:primaryType = oak:QueryIndexDefinition
- evaluatePathRestrictions = true
- type = "lucene"
+ indexRules
+ sling:Message
+ properties
+ SHOULD_ADD_PROPERTY_CONSTRAINT
- name = "SHOULD_ADD_PROPERTY_CONSTRAINT"

 

<i18nIndex
jcr:primaryType="oak:QueryIndexDefinition"
async="[async,nrt]"
compatVersion="2"
evaluatePathRestrictions="{Boolean}true"
includedPaths="[/apps/test/i18n]"
queryPaths="[/apps/test/i18n]"
reindex="{Boolean}false"
reindexCount="{Long}1"
seed="{Long}8687641045336066432"
type="lucene">
<indexRules jcr:primaryType="nt:unstructured">
<sling:Message jcr:primaryType="nt:unstructured">
<properties jcr:primaryType="nt:unstructured">
<SHOULD_ADD_PROPERTY_CONSTRAINT
jcr:primaryType="nt:unstructured"
name="SHOULD_ADD_PROPERTY_CONSTRAINT"
propertyIndex="true"/>
</properties>
</sling:Message>
</indexRules>
</i18nIndex>

 

 

Avatar

Administrator

@vijitha Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni