Expand my Community achievements bar.

Querybuilder casesensitive issue

Avatar

Level 5

Hi Team,

      i was trying to execute below query on my query builder, when i execute this query (search text: Smart Lock) im getting 12 result count which is expected result, same when i execute this query with (search text: smart lock) im getting 0 result. I also tried with the group.2.operation=equalsIgnoreCase by replacing group.2_operation=like but it's not working. Kindly please suggest. my intension was, the query should return 12 result even if i gave the search text upper case or lower case.  Kindly please suggest.

 

QUERY 1 Executed

 

 

 

 

path=/content/wknd/us/en/mypage/support
type=nt:unstructured
group.1_property=sling:resourceType
group.1_property.value=wknd/components/text
group.2_property=text
group.2_operation=like
group.2_property.value=%Smart Lock%
group.p.and=true
p.limit=-1

 

 

 

 

 

  QUERY 2 EXECUTED

 

 

 

path=/content/wknd/ae/en/c/support
type=nt:unstructured
group.1_property=sling:resourceType
group.1_property.value=wknd/components/text
group.2_property=text
group.2_operation=equalsIgnoreCase
group.2_property.value=%Smart Lock%
group.p.and=true
p.limit=-1

 

 

 

 

9 Replies

Avatar

Community Advisor

Operation is a property predicate. Please try

group.2_property.operation=equalsIgnoreCase

 

Avatar

Level 5

Hi @h_kataria , thanks for your response. please find updated query as you suggested but still the expected result 12 was not coming.

QUERY -1
=========
path=/content/wkn/en/us/c/support
type=nt:unstructured
group.1_property=sling:resourceType
group.1_property.value=wknd/components/text
group.2_property=text
group.2_property.operation=equalsIgnoreCase
group.2_property.value=%smart lock%
group.p.and=true
p.limit=-1

QUERY -2
=========
path=/content/wkn/en/us/c/support
type=nt:unstructured
group.1_property=sling:resourceType
group.1_property.value=wknd/components/text
group.2_property=text
group.2_property.operation=equalsIgnoreCase
group.2_property.value=%Smart Lock%
group.p.and=true
p.limit=-1

 

Avatar

Community Advisor

As you can apply one operation at a time, lose the % as it is applicable only for LIKE operation.

group.2_property.value=Smart Lock

Avatar

Level 5

Hi @h_kataria ,

as suggested i applied below query without % but still didnt worked.pfb updated query

path=/content/wkn/en/us/c/support
type=nt:unstructured
group.1_property=sling:resourceType
group.1_property.value=wknd/components/text
group.2_property=text
group.2_property.operation=equalsIgnoreCase
group.2_property.value=Smart Lock
group.p.and=true
p.limit=-1

 

Avatar

Community Advisor

I ran this query and got the expected result. Please check if you actually have the content available which you are trying to search. And share screenshots of results and your content if possible

Avatar

Level 4

Hi @rajat168 ,

 

The above query should work if your property value exactly 

Smart Lock

irrespective of Capitals or small.

Unless you have additional text ex- text: Smart Lock xyz

 

is your use case that,

you have few records value 'Smart Lock' exactly

and

few records may have additional text as i mentioned above, correct?

and, you are expecting both records in result?

 

Thanks,

Raju.

Avatar

Community Advisor

If you are trying to combine case insensitive and LIKE operator, you can try using xpath

/jcr:root/content/wkn/en/us/c/support//element(*, nt:unstructured)
[
(@sling:resourceType = 'wknd/components/text' and (jcr:like(fn:lower-case(@text), '%smart lock%')))
]

 

Avatar

Level 5

Hi @h_kataria ,we used xpath query after thats its working as expected thanks.

Avatar

Community Advisor

Could you please mark my answer as the correct one then. Thanks