Skip to content

Sets

Sets are special scripting variables suitable for holding domain IDs.
They can be predefined or user-defined. In the latter case, they can be created from scratch or derived from existing sets.

Predefined sets

There are two predefined sets:

  • ALL
  • WINNERS

ALL

ALL represents the initial categorization results.
Its value is the set of IDs of the domains with a score, so its contents correspond to the first column of the hidden results table.

Domains which received a DISCARD score will appear in the ALL set with a score of 0.

In the manipulation flow, ALL is read only once at the beginning of the onCategorizer code.

Note

To identify all the discarded domains and those with a valid score, you can use the following code snippet at the beginning of the onCategorizer callback function:

var RESULTS = CLONE(ALL);
var REMOVED = DIFFERENCE(RESULTS, CLEAN(RESULTS, 0));
var SCORED_WITH_SELECTED = INTERSECTION(RESULTS, CLEAN(RESULTS, 0));
var SELECTED = CLEAN(RESULTS, 2147483647);
var SCORED = DIFFERENCE(SCORED_WITH_SELECTED, SELECTED);

Since Studio 4.2.0, when importing an old project, the snippet above is automatically added at the beginning of the onCategorizer function.

WINNERS

WINNERS represents the final results of categorization after manipulation.
If WINNERS contains a domain ID which has a corresponding row in the hidden results table, that row of the table will be returned as final result. Domain IDs without a corresponding entry in the hidden results table are ignored.

In the manipulation flow, WINNERS is populated only once at the end of the onCategorizer code.

User-defined sets

User-defined sets are variables the developer uses as "buckets" for results manipulation.
They must be declared, for example:

var workingSet;
var mediaDoms;

They are populated with functions, for example:

workingSet = CLONE(ALL);

mediaDoms = INTERSECTION(workingSet, mediaTaxonomy);