cancel
Showing results for 
Search instead for 
Did you mean: 

Restricting Seach by folder

vhakkal
Champ in-the-making
Champ in-the-making
Hello,

I am to develop a webscript that will do the following receive all content will in the current folder and it's sub-folders.
Here is what i tried and it did not return any results.
var nodes= search.luceneSearch("PATH:\"/Company%20Home/Public/test//*\"");

I don't know if this is the best way about getting content from a folder or is there a better way of doing.


Thanks,
Vik
1 REPLY 1

mruflin
Champ in-the-making
Champ in-the-making
Hi Vik,

Lucene search requires a qname path, not a name path.

The easiest way to get a qname path is by asking a node to give it to you:

var folderNode = companyhome.childByNamePath("Data Dictionary/Email Templates");
var luceneQuery = "+PATH:\"" + folderNode.qnamePath + "//*\" ";
var nodes = search.luceneSearch(luceneQuery);

If you want to get all files including those in the sub directories, this is probably the best way to go. Don't forget to also search for the correct node type though, e.g.

luceneQuery += " +TYPE:\"{http://www.alfresco.org/model/content/1.0}content\"

Greetings,

Michael