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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

CRXDE Lite Xpath contains() query only returning results when property is specified

Avatar

Level 2

I am trying to run a query against any node inside the path I specify, returning any nodes that contain any property containing the string 'foo'. To do so, I use this query suggested by CRXDE Lite:

 

/jcr:root/content/path//*[jcr:contains(., 'foo')] order by @jcr:score

 

I get no results.

 

But, if I specify a property, let's say html:

 

/jcr:root/content/path//*[jcr:contains(@html, 'foo')] order by @jcr:score

 

I get results.

 

Doesn't the '.' mean to search all properties? If so, why does it not return the results that I receive when I specify a property?

1 Accepted Solution

Avatar

Correct answer by
Employee

I am not sure why that would happen as my comment above was tested on a local OOTB AEM 6.5 instance and gave the expected result.

If you do not have a concern about data loss on local then try the below steps:
> Stop the local instance

> remove crx-quickstart folder

> restart instance

Then try this query

/jcr:root/content/we-retail//*[jcr:contains(., 'men')] order by @jcr:score



View solution in original post

9 Replies

Avatar

Employee

Hi, 

 

I ran the below query, in CRXDE query tool, with property for example below, I got one result as only one node had title containing text 'foo'

/jcr:root/content/we-retail//*[jcr:contains(@jcr:title, 'foo')] order by @jcr:score


And when I ran the below query which has '.' instead of a specific property, I got all resultset containing foo in any of the node properties.

/jcr:root/content/we-retail//*[jcr:contains(., 'foo')] order by @jcr:score


Screen Shot 2022-03-07 at 5.34.09 PM.png

Avatar

Level 2

Thank you for the reply!

 

Interesting, I just tried replicating my experiment in our development environment, and it worked perfectly, just as you've captured. But following the same steps in my local 4502 environment yielded the results I shared in my initial post. Both environments have the same package installed.

 

Any idea what might cause my local environment to behave this way?

Avatar

Correct answer by
Employee

I am not sure why that would happen as my comment above was tested on a local OOTB AEM 6.5 instance and gave the expected result.

If you do not have a concern about data loss on local then try the below steps:
> Stop the local instance

> remove crx-quickstart folder

> restart instance

Then try this query

/jcr:root/content/we-retail//*[jcr:contains(., 'men')] order by @jcr:score



Avatar

Community Advisor

@mpuser 

If you are sure that content (that is queried for) is same/available in both dev and local server, then I suggest to check the index used for the query (using Query Performance -> Explain Query) -> try to reindex and test.

Avatar

Level 2

Hmm, I'm not seeing Query Performance--documentation for 6.4 seems to say it's in Tools > Operations, but I'm on AEM CS (I just realized I didn't mention that in my original post).

 

Does Query Performance exist on CS?

Avatar

Community Advisor

In AEMaaCS local SDK, there is no Operations console (hence no Query Diagnosis/Performance tool)

Can you confirm if your local SDK is latest as that of the DEV cloud service instance? 

 

Avatar

Level 2

The SDK version was mismatched, so I deactivated the old SDK, downloaded the matching SDK, fired it up, installed my code, installed my package, and unfortunately I'm seeing the same results. I'm also seeing some weird UI issues when I choose "query;" deleting the cookies in my browser fixed those, but did not fix the issue with the query results.

Avatar

Community Advisor

I also tried the above and it worked perfectly for me too in my local. I would suggest , set up another server parallel and try it. See if it works.

Avatar

Level 2

Hi Veena, I'm not sure what you mean by setting up another server parallel. 

 

Also, an answer was marked as correct, but I did not mark it as such--the answer marked as correct did not solve my issue. Just mentioning this so that people who have my same issue in the future understand that there's something else going on.