Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

query builder complete reference of built in function

Avatar

Level 2

While researching my query builder problem, I learned that there are built-in functions that you can wrap around the value of a search result.

Here are the two I found:

fn:lower-case()

fn:upper-case()

Is there a complete list of all the built-in function reference that I can use in query builder?

1 Accepted Solution

Avatar

Correct answer by
Employee

I suggest you have a look at our documentation: https://docs.adobe.com/docs/en/aem/6-2/develop/search/querybuilder-api.html
It says: The server-side query builder will accept a query description, create and run an XPath query, optionally filter the result set, and also extract facets, if desired.

The functions you mentioned are not AEM specific, but XPath. You can for example have a look at this page: http://www.w3schools.com/xsl/xsl_functions.asp

View solution in original post

7 Replies

Avatar

Correct answer by
Employee

I suggest you have a look at our documentation: https://docs.adobe.com/docs/en/aem/6-2/develop/search/querybuilder-api.html
It says: The server-side query builder will accept a query description, create and run an XPath query, optionally filter the result set, and also extract facets, if desired.

The functions you mentioned are not AEM specific, but XPath. You can for example have a look at this page: http://www.w3schools.com/xsl/xsl_functions.asp

Avatar

Level 2

Thanks, this is exactly what I am looking for. 

Avatar

Level 2

Follow up question, if QueryBuilder support xPath function, is it converting QueryBuilder query into xpath? Does that mean if I encounter an error where QueryBuilder is having trouble compiling my query into xpath, I should use xpath directly? Or should I use JCR-SQL2? which one is the most direct way to query jcr nodes?

Avatar

Employee

> is it converting QueryBuilder query into xpath?

Yes it converts it to xpath

>Does that mean if I encounter an error where QueryBuilder is having trouble compiling my query into xpath

can you give an example of this problem

>I should use xpath directly? Or should I use JCR-SQL2? which one is the most direct way to query jcr nodes?

You can use either of xpath/sql2, both works and directly works with JCR query engine.

Avatar

Employee

I think amitgupt answered your followup question.

Avatar

Level 2

Hi amitgupt, 

I am trying to do a search base on a user input by using property, property.value, and property.operation="like" to check if the property value contains a string provided by the user.

I am currently on AEM 5.6.1.

Before you jump in to ask me to use fulltext instead of property.value+property.operation="like", I can tell you that I can't use fulltext. The reason is I am under a condition, where I need to check the grand parent of the current node's property value. Only property allow me do property="../../@propertyName" to access the grand parent's property value. I tried it with fulltext.relPath="../../@propertyName", it didn't work.

Now back to the querybuilder parsing problem, in order to check if the properValue contains the string, I use the following combination. property=@propertyName, property.value="%searchTerm%", property.operation="like". This works pretty well, until the user enter searchTerm that ends with "d", for example, the query able to search property value that contains the word "stage" with property.value="%stage%", but it can't search the property value that contains the word "staged". for some reason property.value="%staged%" causes a NullPointerException. 

I hope I give you enough information.

Avatar

Employee

>but it can't search the property value that contains the word "staged". for some reason property.value="%staged%" causes a NullPointerException. 

this seems weird, I see no reason for such behavior. You should create Adobe Support ticket for this, with required logs and other information to reproduce this.