cancel
Showing results for 
Search instead for 
Did you mean: 

Searching based on the folder name

patorjk
Champ in-the-making
Champ in-the-making
How would I search based on folder name? I'm creating a dashlet that allows the user to search for folders. I've got a Share dashlet setup that's talking to an Alfresco web script, but my issue is that in the Alfresco web script, I'm not sure how to search just for folders. I've found I can search the path:

var node,
    item,
    results,
    items = [];

results = search.query({query: "PATH:*alfresco*"});

for (var ii = 0; ii < results.length; ii++) {

    node = results[ii];
   
    item = {
        nodeRef:        node.nodeRef.toString(),
        type:           node.typeShort,
        name:           node.name,
        title:          node.properties["cm:title"],
        description:    node.properties["cm:description"]
    };

    items.push(item);
}

model.items = items;

Though that brings up much more than what I want. How would one construct a query to search for folders based on their name?

thanks,

- Pat
2 REPLIES 2

scouil
Star Contributor
Star Contributor
Hi,


results = search.query({query: "PATH:*alfresco* +TYPE:\"cm:folder\""});

Or you might prefer:

results = search.luceneSearch("+TYPE:\"cm:folder\" +@name:\"*alfresco*\"");

patorjk
Champ in-the-making
Champ in-the-making
That looks like it did the trick, thank you!

- Pat