Docs > API > Finder

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.
Filters
anyState assetAttribute assetType
created creator filename
firstPublished freetext getsContentFrom
groupBy linksTo max
modified modifier name
orderBy owner pageFragment
pageFragmentRange pageType path
published returnContainer returnFormat
role section start
state tag template
type

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);
}


Can't find what you're looking for?

Let us know and we'll see if we can help.