cancel
Showing results for 
Search instead for 
Did you mean: 

search.findNode to get noderef from path giving null everytim

aditya_chaudhar
Champ on-the-rise
Champ on-the-rise
Hi All ,
I am following below document
http://docs.alfresco.com/4.2/references/API-JS-findNode.html

I want to find nodeRef from actual path in alfresco repository.

as per above link
i did below in my javascript controller web script :

var referenceType = "path";
// store type, store id, display path
var reference = ["workspace", "SpacesStore", "Company Home/Shared","1.pdf"];

var foundNode = search.findNode(referenceType, reference);
logger.log("Node path check :"+foundNode);

model.foo = "bar";
model.foundNode="aaa";


But in logs i am getting  foundNode  as null everytime??
what i am missing
I have used existing shared folder to minimize complexity initially?
Where i am going wrong??

My ultimate aim is to find nodeRef of document by file name from actual path.


If any other information is needed please let me know.

Please help me , correct me if i am doing any wrong..
3 REPLIES 3

muralidharand
Star Contributor
Star Contributor
Hi,
You can consider the following points to check.
* Does the file exists really ? !
* Does the current user permission to access it?
* Does the file path is correct ?
* Does the document is indexed by the search engine(SOLR/Lucene) ?


Hi muralidharand ,
Thank you for your quick reply.

My real problem is with last point you mentioned
Does the document is indexed by the search engine(SOLR/Lucene)

I have changed my approach to satisfy need and to complete development in time.
My problem was unexpected behaviour of lucene search ,
As an alternative for i arrived at search.findNode(referenceType, reference);

As this were behaving unexpected and due to some time limits i opt for below simple technique

companyhome.childByNamePath("/sites/sitename/documentlibrary/somename/"+filename);



I know this is not the best solution to search in repository i will update soon on my test results of search.findNode(referenceType, reference);
also about how lucene search behaves unexpectedly in my case

Thanks a lot again for your quick help.

mariosso
Champ in-the-making
Champ in-the-making
Hi,
I would appreciate it somebody provide an answer to the following issue:
I need to search in a particular path using document id but unfortunately
I was only able to perform search if a document is placed under "myfile"(workspace://spacesstore) in share.
If I try searching in path workspace://spacesstore/MYDIR then fails.

Thanks
Marios