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.
SOLVED

What is the use of facets property in lucene oak index?

Avatar

Adobe Champion

I have a custom Lucene index created for my project with all the required properties. This is an assets implementation project and hence the search filters are used to search assets.

P_V_Nair_0-1645552050147.png

This search is OOB, with custom properties added in search facets. This search is not working because of node traversal issues. The page will just show the loading icon, if we search something in the custom properties. These properties which is being searched are already indexed in the custom index and the query is picking the correct custom index as well.

Can someone help me with any property specific to use for search filters/ facets search optimization? Is the facets node and property used for this purpose? Appreciate if someone can shed some lights.

Attaching the explain query results from query performance tool here.

P_V_Nair_0-1645651891096.png

Query causing issue: /jcr:root/content/dam//element(*, dam:Asset)[((fn:lower-case(jcr:content/metadata/@lcl:articleId)='20014477'))]/(rep:facet(jcr:content/metadata/dc:format)|rep:facet(jcr:content/metadata/dam:status))

 

Index definition created: 

P_V_Nair_0-1645652636464.pngP_V_Nair_1-1645652667991.pngP_V_Nair_2-1645652698575.png

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Can you try to remove the "fn:lowercase" function from your query? That should help to avoid traversals without the need to further adjust your index definitions.

View solution in original post

9 Replies

Avatar

Employee Advisor

Can you show the query which is executed and then also the index definitions you created/customized?

Avatar

Adobe Champion

@Jörg_Hoh Updated the description with all the required data you requested for.

Avatar

Correct answer by
Employee Advisor

Can you try to remove the "fn:lowercase" function from your query? That should help to avoid traversals without the need to further adjust your index definitions.

Avatar

Adobe Champion

@Jörg_Hoh  The query all comes OOB. We are using OOB search facets for the search filters and 8just added few custom properties as well in the search facets form. We have checked 'Ignore Case' property and hence the "fn:lowercase" comes in the OOB query.

P_V_Nair_0-1645799652958.png

 

Avatar

Adobe Champion

@Jörg_Hoh  Thanks a lot for your suggestion. I removed the ignorecase for the property from the search facets form and that fixed my issue.

Avatar

Employee Advisor

If just compare digits, ignoring the case is not necessary.

 

But if you also compare characters and you cannot guarantee, that all input is lower-cased already, you would need to adjust your index definition for this property and add a

function=fn:lower-case(@lcl:articleId)

to it. This would apply the lowercase function already at indexing time, so you store only lower-case characters within the index.

 

(The JCR Query Sheet cheat covers this case: https://experienceleague.adobe.com/docs/experience-manager-65/assets/JCR_query_cheatsheet-v1.0.pdf?l...)

Avatar

Adobe Champion

@Jörg_Hoh Can you please me understand here? Does that mean i need to create another property node and add name as 

fn:lower-case(@lcl:articleId

Is this what you were referring to do?

P_V_Nair_0-1645807375650.png

 

Avatar

Employee Advisor

If you are able to remove the fn:lowercase from your query, you don't need to do anything on top of it. Then your index definition is correct.

 

I made this statement just in the case, that you need to keep this function in the query. Only in this case you need to change the index definition.

Avatar

Adobe Champion

@Jörg_Hoh  Thanks you for that suggestion. I have few other properties, where i need to keep the ignorecase function in the search facets form and hence will be coming in the OOB search query. So I will see on how to add those in the indexing rule as function indexing.