Expand my Community achievements bar.

SOLVED

Ampersand (@ character) in querybuilder. What is its use?

Avatar

Level 8

As above. I have a query where I used @ like this (I can’t remember the exact query. I’m on my iPad)


path=/content

1_property=jcr:content/cq:lastModified

 

As an example, I’ll get 500 results. But if I use 

 

1_property=@jcr:content/cq:lastModified

 

i get 501.


Can someone please explain the use of ampersand in this situation.  Thanks

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

 

The @ symbol in AEM Query Builder denotes a full-text search. When you use @ before a property name, it tells Query Builder to perform a full-text search on that property.

In your example, using 1_property=jcr:content/cq:lastModified would search for the exact value of jcr:content/cq:lastModified in the 1_property field. This would return 500 results.

On the other hand, using 1_property=@jcr:content/cq:lastModified would perform a full-text search on the jcr:content/cq:lastModified property. This means that it would search for any words or phrases that match the property value, rather than searching for the exact value itself. This could potentially return more results, which is why you're seeing 501 results instead of 500.

It's important to note that full-text search can be more resource-intensive than exact value search, so it's a good idea to use it judiciously and only when it's necessary.

View solution in original post

3 Replies

Avatar

Community Advisor

@ is used with orderby only

orderby=@jcr:content/cq:lastModified

 and attribute axis (represent by '@' in abbreviated syntax) are supported.

 

If you use @ with property name, there is absolutely no difference

 

With ‘@‘

arunpatidar_0-1682001037138.png

 

without '@'

arunpatidar_2-1682001171570.png

 

 

 



Arun Patidar

Avatar

Community Advisor

Hi @jayv25585659 Over here the difference if specific to what you want in the result

1. If you specify property as @jcr:content/cq:lastReplicatedBy, then in that case the relative path is returned. And in this case the current path's (i.e. /content/wknd/language-masters/en/magazine) jcr:content node resource is ignored.

Shailesh_Bassi__0-1682004989695.png

2. If you specificy just the property as cq:lastReplicatedBy, then in that case it will return the exact path. And in this case as the currentPath i.e. is also having the property cq:lastReplicatedBy, so that resource path is also returned.

 

Shailesh_Bassi__1-1682005203374.png

That's the reason you see the difference of 1.

 Hope this helps!

Thanks

 

Avatar

Correct answer by
Employee Advisor

Hi,

 

The @ symbol in AEM Query Builder denotes a full-text search. When you use @ before a property name, it tells Query Builder to perform a full-text search on that property.

In your example, using 1_property=jcr:content/cq:lastModified would search for the exact value of jcr:content/cq:lastModified in the 1_property field. This would return 500 results.

On the other hand, using 1_property=@jcr:content/cq:lastModified would perform a full-text search on the jcr:content/cq:lastModified property. This means that it would search for any words or phrases that match the property value, rather than searching for the exact value itself. This could potentially return more results, which is why you're seeing 501 results instead of 500.

It's important to note that full-text search can be more resource-intensive than exact value search, so it's a good idea to use it judiciously and only when it's necessary.