X-Git-Url: http://git.indexdata.com/?p=cql-js-moved-to-github.git;a=blobdiff_plain;f=cql.js;h=0a1cc75da057edb05885b256d88941579cad70e9;hp=3cd9028a625d33fbdcf65bda2078d0bc332447f3;hb=2b8022d29d91ccf1a2b5ab66dbe5aec025906433;hpb=a4146b8d04215650aa530ddc70fed17125e53f7c diff --git a/cql.js b/cql.js index 3cd9028..0a1cc75 100644 --- a/cql.js +++ b/cql.js @@ -51,10 +51,17 @@ var CQLSearchClause = function (field, fielduri, relation, relationuri, CQLSearchClause.prototype = { toString: function () { - return (this.field ? this.field + ' ' : '') + - (this.relation ? this.relation : '') + + var field = this.field; + var relation = this.relation; + if (field == 'cql.serverChoice' && relation == 'scr') { + //avoid redundant field/relation + field = null; + relation = null; + } + return (field ? field + ' ' : '') + + (relation ? relation : '') + (this.modifiers.length > 0 ? '/' + this.modifiers.join('/') : '') + - (this.relation || this.modifiers.length ? ' ' : '') + + (relation || this.modifiers.length ? ' ' : '') + '"' + this.term + '"'; }, @@ -143,7 +150,7 @@ CQLBoolean.prototype = { toString: function () { return (this.left.op ? '(' + this.left + ')' : this.left) + ' ' + this.op.toUpperCase() + - (this.modifiers.lenght > 0 ? '/' + this.modifiers.join('/') : '') + + (this.modifiers.length > 0 ? '/' + this.modifiers.join('/') : '') + ' ' + (this.right.op ? '(' + this.right + ')' : this.right);; }, toXCQL: function (n) {