+ },
+
+ toFQ: function () {
+ var s = '{ "term": "'+this.term+'"';
+ if (this.field.length > 0 && this.field != 'cql.serverChoice')
+ s+= ', "field": "'+this.field+'"';
+ if (this.relation.length > 0 && this.relation != 'scr')
+ s+= ', "relation": "'+this._mapRelation(this.relation)+'"';
+ for (var i = 0; i < this.modifiers.length; i++) {
+ //since modifiers are mapped to keys, ignore the reserved ones
+ if (this.modifiers[i].name == "term"
+ ||this.modifiers[i].name == "field"
+ ||this.modifiers[i].name == "relation")
+ continue;
+ s += ', ' + this.modifiers[i].toFQ();
+ }
+ s += ' }';
+ return s;
+ },
+
+ _mapRelation: function (rel) {
+ switch(rel) {
+ case "<" : return "lt";
+ case ">" : return "gt";
+ case "=" : return "eq";
+ case "<>" : return "ne";
+ case ">=" : return "ge";
+ case "<=" : return "le";
+ default: return rel;
+ }