+ team.queue("termlists").subscribe(function(data) {
+ data = data[name];
+ var terms = [];
+ var teamName = team.name();
+ for (var i = 0; i < data.length && i < max; i++) {
+ var linkdata = "";
+ var action = "";
+ if (!pzIndex) {
+ // Special case: target selection
+ linkdata += ('target_id='+data[i].id+' ');
+ if (!team.targetFiltered(data[i].id)) {
+ action = 'mkws.limitTarget(\'' + teamName + '\', this.getAttribute(\'target_id\'),this.firstChild.nodeValue)';
+ }
+ } else {
+ action = 'mkws.limitQuery(\'' + teamName + '\', \'' + pzIndex + '\', this.firstChild.nodeValue)';
+ }
+ linkdata += 'onclick="' + action + ';return false;"';
+ terms.push({
+ term: data[i].name,
+ count: data[i].freq,
+ linkdata: linkdata
+ });
+ }
+ // configured template > facet specific template > default facet template
+ var template;
+ if (that.config.template) {
+ template = team.loadTemplate(that.config.template);
+ } else {
+ template = team.loadTemplate("Facet-" + caption);
+ if (template) {
+ that.log("Using Facet-" + caption + " template.")
+ } else {
+ that.log("No " + caption + " specific template, using default.")
+ template = team.loadTemplate("Facet");
+ }
+ }
+ that.node.html(template({
+ name: name,
+ caption: caption,
+ terms: terms
+ }));
+ });
+ this.autosearch();