Commit 30ce96a4 authored by Tristan Cavelier's avatar Tristan Cavelier

jio.js updated

parent aae4a9af
...@@ -4363,7 +4363,7 @@ function ComplexQuery(spec, key_schema) { ...@@ -4363,7 +4363,7 @@ function ComplexQuery(spec, key_schema) {
* @default "AND" * @default "AND"
* @optional * @optional
*/ */
this.operator = spec.operator || "AND"; this.operator = spec.operator;
/** /**
* The sub Query list which are used to query an item. * The sub Query list which are used to query an item.
...@@ -4384,6 +4384,9 @@ function ComplexQuery(spec, key_schema) { ...@@ -4384,6 +4384,9 @@ function ComplexQuery(spec, key_schema) {
} }
inherits(ComplexQuery, Query); inherits(ComplexQuery, Query);
ComplexQuery.prototype.operator = "AND";
ComplexQuery.prototype.type = "complex";
/** /**
* #crossLink "Query/match:method" * #crossLink "Query/match:method"
*/ */
...@@ -4399,12 +4402,20 @@ ComplexQuery.prototype.match = function (item) { ...@@ -4399,12 +4402,20 @@ ComplexQuery.prototype.match = function (item) {
* #crossLink "Query/toString:method" * #crossLink "Query/toString:method"
*/ */
ComplexQuery.prototype.toString = function () { ComplexQuery.prototype.toString = function () {
var str_list = ["("], this_operator = this.operator; var str_list = [], this_operator = this.operator;
if (this.operator === "NOT") {
str_list.push("NOT (");
str_list.push(this.query_list[0].toString());
str_list.push(")");
return str_list.join(" ");
}
this.query_list.forEach(function (query) { this.query_list.forEach(function (query) {
str_list.push("(");
str_list.push(query.toString()); str_list.push(query.toString());
str_list.push(")");
str_list.push(this_operator); str_list.push(this_operator);
}); });
str_list[str_list.length - 1] = ")"; // replace last operator str_list.length -= 1;
return str_list.join(" "); return str_list.join(" ");
}; };
...@@ -4418,7 +4429,9 @@ ComplexQuery.prototype.serialized = function () { ...@@ -4418,7 +4429,9 @@ ComplexQuery.prototype.serialized = function () {
"query_list": [] "query_list": []
}; };
this.query_list.forEach(function (query) { this.query_list.forEach(function (query) {
s.query_list.push(query.serialized()); s.query_list.push(
typeof query.toJSON === "function" ? query.toJSON() : query
);
}); });
return s; return s;
}; };
...@@ -4678,6 +4691,7 @@ function SimpleQuery(spec, key_schema) { ...@@ -4678,6 +4691,7 @@ function SimpleQuery(spec, key_schema) {
} }
inherits(SimpleQuery, Query); inherits(SimpleQuery, Query);
SimpleQuery.prototype.type = "simple";
var checkKey = function (key) { var checkKey = function (key) {
var prop; var prop;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment