Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Search working only on Title and URL - Lucene index

Avatar

Avatar
Validate 1
Level 2
ashishkhadpe
Level 2

Likes

4 likes

Total Posts

48 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
ashishkhadpe
Level 2

Likes

4 likes

Total Posts

48 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Boost 3
Boost 1
View profile
ashishkhadpe
Level 2

04-02-2021

Hi Everyone,

 

We have just upgraded to AEM 6.5. Previously on AEM 6.2 version, our search functionality was not using any index but by traversing the node was giving the results. With AEM 6.5, we have fixed our lucene index and our search is using the index now to search.

Issue we are facing now is that when we search for any term, it only uses the URI and title of the page to search. Is there any configuration using which I can force my lucene index to search within body of my page as well?

 

My query looks like below :

select [jcr:path], [jcr:score], [rep:excerpt] from [nt:hierarchyNode] as a where isdescendantnode(a, '/content/mysite') and [jcr:content/hideFromSearch] is null and contains([jcr:content/*], 'Media')

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Level 2
lucian_nicolaescu
Level 2

Likes

8 likes

Total Posts

7 posts

Correct Reply

3 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Boost 5
Level 2
lucian_nicolaescu
Level 2

Likes

8 likes

Total Posts

7 posts

Correct Reply

3 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile
lucian_nicolaescu
Level 2

04-02-2021

You can and should add an index like:

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
    xmlns:dam="http://www.day.com/dam/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    jcr:primaryType="oak:Unstructured"
    async="async"
    compatVersion="{Long}2"
    evaluatePathRestrictions="{Boolean}true"
    functionName="my-custom-search-index"
    includedPaths="/content"
    reindex="{Boolean}true"
    reindexCount="{Long}0"
    type="lucene">
    <aggregates jcr:primaryType="nt:unstructured">
        <cq:Page jcr:primaryType="nt:unstructured">
            <include0
                jcr:primaryType="nt:unstructured"
                path="jcr:content/*"
                relativeNode="{Boolean}true"/>
            <include1
                jcr:primaryType="nt:unstructured"
                path="jcr:content/*/*"
                relativeNode="{Boolean}true"/>
            <!-- how deep you want to go or something like (/.+)* -->
        </cq:Page>
    </aggregates>
    <indexRules jcr:primaryType="nt:unstructured">
        <cq:Page
            jcr:primaryType="nt:unstructured"
            includePropertyTypes="all">
            <properties jcr:primaryType="nt:unstructured">
                <cqTags
                    jcr:primaryType="nt:unstructured"
                    analyzed="{Boolean}true"
                    isRegexp="{Boolean}false"
                    name="jcr:content/cq:tags"
                    nodeScopeIndex="{Boolean}true"
                    propertyIndex="{Boolean}false"
                    type="String"/>
                <jcrTitle
                    jcr:primaryType="nt:unstructured"
                    analyzed="{Boolean}true"
                    isRegexp="{Boolean}false"
                    name="jcr:content/jcr:title"
                    nodeScopeIndex="{Boolean}true"
                    propertyIndex="{Boolean}false"
                    type="String"/>
                <text
                    jcr:primaryType="nt:unstructured"
                    analyzed="{Boolean}true"
                    isRegexp="{Boolean}false"
                    name="jcr:content(/.+)*/text"
                    nodeScopeIndex="{Boolean}true"
                    propertyIndex="{Boolean}false"
                    type="String"/>
                <!-- Other "properties" that you want to index, because you don't want to index dates or I don't know -->
            </properties>
        </cq:Page>
        <dam:Asset
            jcr:primaryType="nt:unstructured"
            includePropertyTypes="all">
            <properties jcr:primaryType="nt:unstructured">
                <jcrTitle
                    jcr:primaryType="nt:unstructured"
                    analyzed="{Boolean}true"
                    isRegexp="{Boolean}false"
                    name="jcr:content/metadata/jcr:title"
                    nodeScopeIndex="{Boolean}true"
                    propertyIndex="{Boolean}false"
                    type="String"/>
                <cqName
                    jcr:primaryType="nt:unstructured"
                    analyzed="{Boolean}true"
                    isRegexp="{Boolean}false"
                    name="jcr:content/cq:name"
                    nodeScopeIndex="{Boolean}true"
                    propertyIndex="{Boolean}false"
                    type="String"/>
                <dcTitle
                    jcr:primaryType="nt:unstructured"
                    analyzed="{Boolean}true"
                    isRegexp="{Boolean}false"
                    name="jcr:content/metadata/dc:title"
                    nodeScopeIndex="{Boolean}true"
                    propertyIndex="{Boolean}false"
                    type="String"/>
                <dcDescription
                    jcr:primaryType="nt:unstructured"
                    analyzed="{Boolean}true"
                    isRegexp="{Boolean}false"
                    name="jcr:content/metadata/dc:description"
                    nodeScopeIndex="{Boolean}true"
                    propertyIndex="{Boolean}false"
                    type="String"/>
                <cqAssetTags
                    jcr:primaryType="nt:unstructured"
                    analyzed="{Boolean}true"
                    isRegexp="{Boolean}false"
                    name="jcr:content/metadata/cq:tags"
                    nodeScopeIndex="{Boolean}true"
                    propertyIndex="{Boolean}false"
                    type="String"/>
            </properties>
        </dam:Asset>
    </indexRules>
</jcr:root>

 

 

More details about indexes here: https://jackrabbit.apache.org/oak/docs/query/lucene.html 

You can also check your indexes here: http://localhost:4502/libs/granite/operations/content/diagnosistools/indexManager.html 

PS: make sure your index is deployed... and reindex triggered when you make changes to the index definition.

Answers (0)