AEM 6.5 search auto suggestions | Community
Skip to main content
July 31, 2023

AEM 6.5 search auto suggestions

  • July 31, 2023
  • 1 reply
  • 1450 views

Hello Guys,

I am trying to fetch auto suggestions with a specified custom index and getting null results.I really appreciate your thoughts on it.

SELECT [rep:suggest()] FROM [cq:Page] WHERE SUGGEST('tes') OPTION(INDEX NAME [testindex])

 

Tried lot of select queries but anything with specific index name giving 0 results but with OTB cqPageLucene giving results.

 

<testindex
jcr:primaryType="oak:QueryIndexDefinition"
async="[async,nrt]"
compatVersion="{Long}2"
evaluatePathRestrictions="{Boolean}true"
excludedPaths="[/var,/etc/replication,/etc/workflow/instances,/jcr:system]"
includedPaths="[/content/test]"
queryPaths="/content/test"
reindex="{Boolean}false"
reindexCount="{Long}17"
seed="{Long}-3675128066810099332"
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>
<nt:file jcr:primaryType="nt:unstructured">
<include0
jcr:primaryType="nt:unstructured"
path="jcr:content"/>
</nt:file>
<cq:PageContent jcr:primaryType="nt:unstructured">
<include0
jcr:primaryType="nt:unstructured"
path="*"/>
<include1
jcr:primaryType="nt:unstructured"
path="*/*"/>
<include2
jcr:primaryType="nt:unstructured"
path="*/*/*"/>
<include3
jcr:primaryType="nt:unstructured"
path="*/*/*/*"/>
</cq:PageContent>
</aggregates>
<indexRules jcr:primaryType="nt:unstructured">
<cq:Page jcr:primaryType="nt:unstructured">
<properties jcr:primaryType="nt:unstructured">
<cqLastModified
jcr:primaryType="nt:unstructured"
name="jcr:content/cq:lastModified"
ordered="{Boolean}true"
propertyIndex="{Boolean}true"
type="Date"/>
<jcrTitle
jcr:primaryType="nt:unstructured"
name="jcr:content/jcr:title"
nodeScopeIndex="{Boolean}true"
propertyIndex="{Boolean}true"
type="String"
useInSpellcheck="{Boolean}true"
useInSuggest="{Boolean}true"/>
<pageTitle
jcr:primaryType="nt:unstructured"
name="jcr:content/pageTitle"
nodeScopeIndex="{Boolean}true"
propertyIndex="{Boolean}true"
type="String"
useInSpellcheck="{Boolean}true"
useInSuggest="{Boolean}true"/>
<navTitle
jcr:primaryType="nt:unstructured"
name="jcr:content/navTitle"
nodeScopeIndex="{Boolean}true"
propertyIndex="{Boolean}true"
type="String"
useInSpellcheck="{Boolean}true"
useInSuggest="{Boolean}true"/>
<nodeName
jcr:primaryType="nt:unstructured"
name=":nodeName"
nodeScopeIndex="{Boolean}true"
propertyIndex="{Boolean}true"
type="String"
useInSpellcheck="{Boolean}true"
useInSuggest="{Boolean}true"/>
<cqLastRolledoutBy
jcr:primaryType="nt:unstructured"
name="jcr:content/cq:lastRolledoutBy"
propertyIndex="{Boolean}true"
type="String"/>
<location
jcr:primaryType="nt:unstructured"
name="jcr:content/location"
notNullCheckEnabled="{Boolean}true"
propertyIndex="{Boolean}true"
type="String"/>
<jcrDesc
jcr:primaryType="nt:unstructured"
name="jcr:content/jcr:description"
nodeScopeIndex="{Boolean}true"
propertyIndex="{Boolean}true"
type="String"
useInSpellcheck="{Boolean}true"
useInSuggest="{Boolean}true"/>
</properties>
</cq:Page>
</indexRules>
<suggestion
jcr:primaryType="nt:unstructured"
suggestAnalyzed="{Boolean}true"
suggestUpdateFrequencyMinutes="{Long}1"/>
</testindex>
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

aanchal-sikka
Community Advisor
Community Advisor
August 1, 2023

hello @shan1234 

 

Index selection in Native queries seems to have been deprecated. https://jackrabbit.apache.org/oak/docs/query/lucene.html 

 

 

We should update cqPageLucene judiciously and use it.

 

Aanchal Sikka
shan1234Author
August 1, 2023

Hello @aanchal-sikka ,Thank you for replying.

So when you have multiple customers on your aem instance's, how can we pollute the cqPageLucene with specifying included path and query path.Since many customers were using it, we wanted to create our own index and paths defined there.

So my other concern is auto suggestions are not giving expected results while using cqPageLucene when not defining included path and query path and they are giving more of search suggestions.

 

For example, consider a scenario where a user starts typing "ca" in a search input field:

 

 Auto-suggestion: As the user types "ca," the auto-suggestion should show real-time suggestions like "car," "cat," and "camera," .
 

Search suggestion: If the user is interacting with a search bar, the search suggestion might display frequently searched terms like "camera accessories," "catering services," and "car rental,".