cancel
Showing results for 
Search instead for 
Did you mean: 

Get all values of node property.

madzi
Champ in-the-making
Champ in-the-making
Hello.

I have node (own type) with some property.
How i can get all stored values of this property in my JS code ?

I can search all nodes and get value of this property in loop, like:

function getPropValues(myProperty) {
    var i, nodes, result = {};
    nodes = search.luceneSearch("TYPE:\"cm:MyNodeType\"");
    for (i = 0; i < nodes.length; i++) {
        result.push(nodes[i].myProperty);
    }
    return result;
}
but i think, the solve may be easier.
1 REPLY 1

afaust
Legendary Innovator
Legendary Innovator
Hello,

there is no ready-to-use operation you could use to extract all values of a property. Searching and iterating is not the way to go, but the only one that works without much more low level implementation. On a low level approach you could use stored Lucene fields to load all values, SOLR facets or implement a custom DB query - all require (some) implementation using Java.

Regards
Axel