Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

Afer creating custom index, sql query on cq:PageContent is not working

Avatar

Level 1

After custom index is created, queries on cq:PageContent always giving no results. When I delete the custom index, I am able to see the results.

Below is the custom index I created. Can someone help me in identifying what went wrong with the below index which is blocking cq:PageContent to produce search results?

 

 

<websiteSearch jcr:primaryType="oak:QueryIndexDefinition" async="async" compatVersion="{Long}2" evaluatePathRestrictions="{Boolean}true" includedPaths="[/content/mysite]" indexPath="/oak:index/websiteSearch" name="cq:Page" reindex="{Boolean}false" reindexCount="{Long}5" type="lucene"> <aggregates jcr:primaryType="nt:unstructured"> <cq:Page jcr:primaryType="nt:unstructured"> <include0 jcr:primaryType="nt:unstructured" path="jcr:content" relativeNode="{Boolean}true"/> </cq:Page> <cq:PageContent jcr:primaryType="nt:unstructured"> <include0 jcr:primaryType="nt:unstructured" path="*" relativeNode="{Boolean}false"/> <include1 jcr:primaryType="nt:unstructured" path="*/*" relativeNode="{Boolean}false"/> <include2 jcr:primaryType="nt:unstructured" path="*/*/*" relativeNode="{Boolean}false"/> <include3 jcr:primaryType="nt:unstructured" path="*/*/*/*" relativeNode="{Boolean}false"/> </cq:PageContent> </aggregates> <indexRules jcr:primaryType="nt:unstructured"> <cq:Page jcr:primaryType="nt:unstructured"> <properties jcr:primaryType="nt:unstructured"> <headingText jcr:primaryType="nt:unstructured" analyzed="{Boolean}true" name="headingText" propertyIndex="{Boolean}true"/> <headline jcr:primaryType="nt:unstructured" analyzed="{Boolean}true" name="headline"/> <bodycopy jcr:primaryType="nt:unstructured" analyzed="{Boolean}true" name="jcr:content/bodycopy"/> <tags jcr:primaryType="nt:unstructured" analyzed="{Boolean}true" name="jcr:content/cq:tags"/> <title jcr:primaryType="nt:unstructured" analyzed="{Boolean}true" name="jcr:content/jcr:title"/> <lastModified jcr:primaryType="nt:unstructured" name="jcr:content/cq:lastModified" ordered="{Boolean}true"/> <mysiteAuthor jcr:primaryType="nt:unstructured" analyzed="{Boolean}true" name="jcr:content/mysiteAuthor"/> <hideInSearch jcr:primaryType="nt:unstructured" name="jcr:content/hideInSearch" nullCheckEnabled="{Boolean}true" propertyIndex="{Boolean}true"/> <blocktitle jcr:primaryType="nt:unstructured" analyzed="{Boolean}true" name="jcr:content/blocktitle"/> <originalPublishedDate jcr:primaryType="nt:unstructured" name="jcr:content/originalPublishedDate" ordered="{Boolean}true"/> <pageType jcr:primaryType="nt:unstructured" name="jcr:content/pageType" propertyIndex="{Boolean}true"/> </properties> </cq:Page> </indexRules> </websiteSearch>
2 Replies

Avatar

Level 10

Custom Index is used so AEM does not search entire repo. When you use JCR SQL - you specify what part of the repository to search. For example:

SELECT * from [nt:base] AS t WHERE ISDESCENDANTNODE('/content/ftl-sample-site')

I am not sure what value a custom index is when you are using JCR SQL2 - seems redundant. 

See this doc: https://docs.adobe.com/docs/en/aem/6-0/deploy/best-practices/best-practices-for-queries-and-indexing...

Also - watch this GEMs session on Indexing: 

https://docs.adobe.com/ddc/en/gems/oak-lucene-indexes.html

Avatar

Level 1

I am searching the same repository which i am indexing. Below is the SQL query I am trying. It is giving "no results". Where as when i search for [cq:Page] and [nt:base]  results are displayed properly

SELECT * from [cq:PageContent] AS t WHERE ISDESCENDANTNODE([/content/mysite])

One more question: When custom index is created, everytime when i need to execute a query which properties are not indexed in custom index, do I need to modify custom index to add those query properties?