The Finder class is used to retrieve a filtered set of items. An array of filter criteria are passed as an argument to the constructor. The result is returned as an ItemSet, which can be iterated through like an array.
| Constructor |
| Finder(filters) | The filters argument is an array of filter criteria, each of which is a JSON-style object literal. |
| Properties |
| criteria | Array of search filters. |
| Methods |
| addCriterion(filter) | Add an additional filter criterion after the Finder has been instantiated. |
| find() | Execute the search, returning an ItemSet. |
Examples
var f = new Finder([
{type: 'page'},
{template: 'Article'},
{section: 'news/europe'},
{orderBy: 'creation-date', reverse:true}
{max:10}
]);
var result = f.find();
for (var i=0; i < result.items; i++) {
out.writeln(result.items[i].name);
}