使用querybuilder在CQ5中区分大小写的搜索 [英] Case insensitive search in CQ5 using querybuilder

查看:119
本文介绍了使用querybuilder在CQ5中区分大小写的搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请建议如何使用CQ5中的querybuilder实施不区分大小写的搜索。我的代码如下...

Please suggest on how to implement case insensitive search using querybuilder in CQ5. My code is as below ...

paramMap.put("1_property", searchType);
paramMap.put("1_property.value", "%" + searchString + "%");
paramMap.put("1_property.operation", "like");
paramMap.put("2_property", "documentId");
paramMap.put("2_property.operation", "exists");
paramMap.put("3_orderby.sort", "asc");
paramMap.put("p.limit", "0");

searchType是节点属性
searchString是需要匹配的字符串

searchType is the node property searchString is the string that needs to be matched

当前,它执行区分大小写的搜索。我尝试了此处提到的解决方案
http://www.wemblog.com/2013/04/how-to-create-custom-query-predicate-in.html
没能解决。

Presently, it does a case sensitive search. I tried the solution mentioned here http://www.wemblog.com/2013/04/how-to-create-custom-query-predicate-in.html It didnt work out.

推荐答案

我遇到了同样的问题,并找到了使用QueryBuilder进行不区分大小写搜索的3种可能的解决方案:

I have faced the same question and found 3 possible solutions for case-insensitive search using QueryBuilder:


  1. 您上面提到的自定义查询谓词

全文谓词。

缺点:它很贪心,会找到所有%your_search_query%匹配项。

详细信息在这里: http://maxbarrass.blogspot.com/2014/05/jcr-predicate-operations-in- aem.html

节点名谓词。

这是解决方法,仅当您正在搜索正确的 jcr:title ty,因为在大多数情况下,节点名=小写且转义了jcr:title。

因此,您可以搜索 nodename 而不是 jcr:titl e属性。

nodename predicate.
This is workaround and works only if you are searching for jcr:title property because in most cases nodename = lowercased and escaped jcr:title.
So, you can search for nodename instead of jcr:title property.

第三种方法对我有好处。

Third approach was good for me.

这篇关于使用querybuilder在CQ5中区分大小写的搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆