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

AEM 6.2 "fn:lowercase" is not working

Avatar

Avatar
Give Back 5
Level 2
Unnikrishnankv
Level 2

Likes

2 likes

Total Posts

33 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 1
Validate 10
View profile

Avatar
Give Back 5
Level 2
Unnikrishnankv
Level 2

Likes

2 likes

Total Posts

33 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 1
Validate 10
View profile
Unnikrishnankv
Level 2

02-01-2017

Dear Team,  

. How I can incoperate case sensitive search in AEM 6.2 with predicates.

I have tried below mentioned code unfortunately it doesn't work for me.But it is working fine in  5.6.1

Predicate authorNamePredicate = new Predicate("@authorName", "property");
authorNamePredicate.set(JcrPropertyPredicateEvaluator.OPERATION, JcrPropertyPredicateEvaluator.OP_LIKE);
                 authorNamePredicate
                     .set("property", "@fn:lower-case(@" + JcrConstants.JCR_CONTENT + "/" + "authorName" + ")");
                 authorNamePredicate.set("value", "%" + author.toLowerCase() + "%");
                 authorgroup.add(authorNamePredicate);

 

@fn:lower-case(" - is converted to fn:lower-case_x0028_  this is creating issue in AEM 6.2

 "/jcr:root/content/geo//*[@jcr:primaryType = 'cq:Page' and not(jcr:content/@hideInNav) and jcr:content/@jcr:title != 'Master Article' and jcr:like(fn:lower-case_x0028_/jcr:content/@authorName_x0029_, 'soumik dey')]/rep:excerpt(.) order by jcr:content/@cq:lastModified descending" This is the query it generating 

 

Thanks!

Unnikrishnan

Replies

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,168 likes

Total Posts

6,294 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,168 likes

Total Posts

6,294 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

02-01-2017

Hi 

Please have a look at this forum thread:-

Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

//  we never officially supported functions.  Hence not a bug. You have to file enhancement request to support xpath function. it is a known problem with the OAK repository

Please create a day care ticket for this.

 

Reference post telling about toupper/toLower in AEM :- http://www.wemblog.com/2013/04/how-to-create-custom-query-predicate-in.html

// You need to create a create custom query predicate.

I hope this would help you.

~kautuk

Avatar

Avatar
Give Back 5
Level 2
Unnikrishnankv
Level 2

Likes

2 likes

Total Posts

33 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 1
Validate 10
View profile

Avatar
Give Back 5
Level 2
Unnikrishnankv
Level 2

Likes

2 likes

Total Posts

33 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 1
Validate 10
View profile
Unnikrishnankv
Level 2

02-01-2017

Thank you  kautuk , I have tried custom predicate in this case it throwing same error like "java.text.ParseException: Query". Am using  fn:lowercase with predicates not in query.  I have raised to  Adobe team internally  and they created Day care ticket for that. Can you confirm  xpath queries are not supported in AEM 6.2 ? It will helpful for us . Our search concept working with predicates, so we need to change entire search code if it not supported.

Thanks!, 

Unnikrishnan

Avatar

Avatar
Give Back 5
Level 1
ravi_ks007
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 1
View profile

Avatar
Give Back 5
Level 1
ravi_ks007
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 1
View profile
ravi_ks007
Level 1

15-01-2018

Hi Kirshnan,

Is this issue solved? I am also facing the same issue, let me know creating the day care tickets helped?

Thanks,

Ravi

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,168 likes

Total Posts

6,294 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,168 likes

Total Posts

6,294 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

16-01-2018

Workaround: converted the query to SQL2 version in our code, this would work

Please create day care ticket!!

-Kautuk

Avatar

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

276 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

276 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
edubey
Level 10

16-01-2018

This is not the exact code which you would need but should help you to proceed.


import com.day.cq.search.Predicate;
import com.day.cq.search.eval.AbstractPredicateEvaluator;
import com.day.cq.search.eval.EvaluationContext;
import org.apache.felix.scr.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jcr.query.Row;

/**
* Custom case insensitive predicate for like operation
* caseinsensitive.property=jcr:content/@jcr:title
* caseinsensitive.value= queryString %
*
*/
@Component(
metatype = false,
factory = "com.day.cq.search.eval.PredicateEvaluator/caseinsensitive"
)
public class CaseInsensitiveLikePredicate extends AbstractPredicateEvaluator
{
public static final String PROPERTY = "property";
public static final String VALUE = "value";
public static final String WILDCARD = "%";
@Override
public boolean includes(Predicate predicate, Row row, EvaluationContext context)
{
if (predicate.hasNonEmptyValue(PROPERTY))
{
return true;
}
return super.includes(predicate, row, context);
}

@Override
public String getXPathExpression(Predicate predicate, EvaluationContext context)
{
if (!predicate.hasNonEmptyValue(PROPERTY))
{
return null;
}
if(predicate.hasNonEmptyValue(PROPERTY) && null==predicate.get(VALUE)){
return super.getXPathExpression(predicate, context);
}
if (predicate.hasNonEmptyValue(PROPERTY))
{
predicate.get(VALUE);
if (WILDCARD.equals(predicate.get(VALUE))) {
logger.info("Case Insensitive Query only has wildcard, ignoring predicate");
return "";
}
logger.info("jcr:like(fn:lower-case(" + predicate.get(PROPERTY) +"), '" +predicate.get(VALUE).toLowerCase()+ "')");
return "jcr:like(fn:lower-case(" + predicate.get(PROPERTY) + "),'" +predicate.get(VALUE).toLowerCase()+ "')";
}
return null;
}
}

Avatar

Avatar
Give Back 5
Level 1
ravi_ks007
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 1
View profile

Avatar
Give Back 5
Level 1
ravi_ks007
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 1
View profile
ravi_ks007
Level 1

16-01-2018

Thanks Kautuk, will raise a ticket and see if we can convert our search module to use sql2.

Avatar

Avatar
Give Back 5
Level 1
ravi_ks007
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 1
View profile

Avatar
Give Back 5
Level 1
ravi_ks007
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 1
View profile
ravi_ks007
Level 1

16-01-2018

Thanks edubey, appreciate your support. The problem that I have to use this approach is that our query is slightly complexed with multiple properties queried. It looks like below, With your code approach, I cant just use

caseinsensitive.property=jcr:content/@jcr:title

* caseinsensitive.value= queryString %.

Any idea how we can tackle this?

fulltext=tax

mainasset=true

1_group.1_group.path=/content/project_name

2_group.1_group.type=cq:Page

2_group.1_group.p.or=true

1_group.2_group.path=/content/dam/project_name

1_group.p.or=true

2_group.2_group.type=dam:Asset

2_group.p.or=true

2_group.2_group.1_property=jcr:content/metadata/dc:format

2_group.2_group.1_property.1_value=application/pdf

2_group.2_group.5_group.2_property.operation=like

2_group.2_group.5_group.2_property=jcr:content/metadata/dc:description

2_group.2_group.5_group.2_property.1_value=%tax%

2_group.2_group.5_group.3_property.operation=like

2_group.2_group.5_group.3_property=jcr:content/metadata/cq:tags

2_group.2_group.5_group.3_property.1_value=%tax%

2_group.2_group.5_group.4_property.operation=like

2_group.2_group.5_group.4_property=jcr:content/metadata/dc:title

2_group.2_group.5_group.4_property.1_value=%tax%

2_group.2_group.5_group.p.or=true

3_group.p.and=true

3_group.property=jcr:content/hideInSearch

3_group.property.operation=not

5_group.1_relativedaterange.property=jcr:content/cq:lastModified

5_group.1_relativedaterange.upperBound=0

2_group.1_group.2_property=jcr:content/contentType

2_group.1_group.2_property.1_value=Article

2_group.1_group.1_property=jcr:content/cq:tags

2_group.1_group.1_property.1_value=%tax%

2_group.1_group.1_property.operation=like

Avatar

Avatar
Give Back 5
Level 2
Unnikrishnankv
Level 2

Likes

2 likes

Total Posts

33 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 1
Validate 10
View profile

Avatar
Give Back 5
Level 2
Unnikrishnankv
Level 2

Likes

2 likes

Total Posts

33 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 1
Validate 10
View profile
Unnikrishnankv
Level 2

18-01-2018

Thanks you ,

It is working .i have already implemented in my project and i forgot to mentioned here .. 

Avatar

Avatar
Level 1
meenuk61586806
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile

Avatar
Level 1
meenuk61586806
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile
meenuk61586806
Level 1

08-04-2019

Hi Devakrishna

I am facing similar issue in my Code. Could you please explain how you resolved it?