cancel
Showing results for 
Search instead for 
Did you mean: 

Search content by XPath

hunterbit
Champ in-the-making
Champ in-the-making
Hello everyone,
I have a folder and in this folder I have many content (image, pdf and other),
now I want to find a specific file in this folder using a name or part of a name, how can I do?
thank you.

Rocco.
6 REPLIES 6

alexv
Champ in-the-making
Champ in-the-making

hunterbit
Champ in-the-making
Champ in-the-making
thank,
but I have to see that page and I tried but I have always error and I dont known because.
Excuse me for my english.

alexv
Champ in-the-making
Champ in-the-making
Double-checked, if it is available. It is available. Just don't give up Smiley Happy

hunterbit
Champ in-the-making
Champ in-the-making
Still I did not manage to solve the problem with research.
My need is to find a file in a  specific location, so I use a search string like "/app:company_home/cm:content/cm:documents/cm:thumbnails/cmSmiley Tongueippo.jpg"
Unfortunately I do not find nothing in that folder even if the file is present.
If instead I use as the search string "/app:company_home/cm:content/cm:documents/cm:thumbnails/*" I find all the files.
how can I do to look for a file (an image for example) given its name to a particular path?
Thank you.

jlabuelo
Champ on-the-rise
Champ on-the-rise
Hi there

I am able to find a content node using the XPATH hope this helps for you:
 stringQuery = "+PATH:\"/app:company_home/cm:Logos/cm:"+filename+".jpg\""
                    + "+TYPE:\"" + ContentModel.TYPE_CONTENT + "\"";
                   
                     storeRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE;
                     results = getSearchService().query(storeRef,
                    this.getSearchService().LANGUAGE_LUCENE, stringQuery);

However I have a problem, when the name of the node has spaces this function does not work. For example in the Space "Logos" in the Company Home space, I have a file called "El Periodico.jpg". If I search using this code for this node it fails…. however if the name has no spaces "EL_Periodico.jpg" it works fine… however I need the names of the content nodes to have spaces…. How can I do to use this code to find nodes which names have white spaces?

Thanks in advance

andy
Champ on-the-rise
Champ on-the-rise
Hi

Spaces in paths need to be encoded (_x0020_).

If you need to check the path to a file etc, use the node browser.

Andy