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

Indexing issue when trying to get a node name matching a value from JCR

Avatar

Level 5

I have the below query to get a image node from an instance over 1 million assets 

 

type=dam:Asset

path=/content/dam/company/product-assets

nodename=test.tif

p.limit=-1

 

 

XPATH Query

/jcr:root/content/dam/company/product-assets//element(*, dam:Asset)
[
(fn:name() = 'test.tif')
]

 

SQL2

select [jcr:path], [jcr:score], * from [dam:Asset] as a where name(a) = 'test.tif' and isdescendantnode(a, '/content/dam/company/product-assets')

 

This gives me node traversal error. Can someone help me how I can recreate this query or how to index fn:name?

 

Below is what the oak generation tool gave definition for creating index and this is still in place But still it gives indexing error.

P_V_Nair_0-1661440924530.png

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Try this 

path= /content/dam/company/product-assets
property = jcr:primaryType
property.name = dam:Asset
fulltext = test.tif
p.limit=-1

As there is already an index for fulltext you should not get any traversal error, if you still get the same error. I would suggest adding an addtional identifier to the query.

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Try this 

path= /content/dam/company/product-assets
property = jcr:primaryType
property.name = dam:Asset
fulltext = test.tif
p.limit=-1

As there is already an index for fulltext you should not get any traversal error, if you still get the same error. I would suggest adding an addtional identifier to the query.

Avatar

Level 5

Hi @Anmol_Bhardwaj  Thanks for your time. But, if my understanding is correct, this query will search for the full text in the repo and return all results matching that text.tif. It will even list any property nodes containing that text instead of returning the correct matching node alone. So we might need to go for additional logic in the code to validate it. Is my understanding correct?

 

Avatar

Community Advisor

fulltext will just look for certain fields like node name or jcr:title.

If you need to expand or restrict the nodes it searched for, you can use fulltext.relpath

 

fulltext.relPath is the relative path to search in (eg. property or subnode) eg. fulltext.relPath=jcr:content or fulltext.relPath=jcr:content/@cq:tags

You can also add wildcard to it example fulltext.relPath=jcr:content/*

This was you can restrict where and which nodes it searches.