From 2b8022d29d91ccf1a2b5ab66dbe5aec025906433 Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Thu, 18 Oct 2012 15:07:26 +0200 Subject: [PATCH] Avoid serializing redundant relation/field --- cql.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cql.js b/cql.js index 1f9b126..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 + '"'; }, -- 1.7.10.4