Commit 929e8bc4 authored by Hardik Juneja's avatar Hardik Juneja

fix build query to refect the changes

parent 17d394dd
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
} }
} }
value = mapProperty(new_mapping_dict, key, value, true).value; value = mapProperty(new_mapping_dict, key, value, true, isQuery).value;
} }
if (_mapping_dict.equal !== undefined) { if (_mapping_dict.equal !== undefined) {
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
new_prop = Object.keys(_mapping_dict.equal)[0]; new_prop = Object.keys(_mapping_dict.equal)[0];
new_mapping_dict = _mapping_dict.equal[new_prop]; new_mapping_dict = _mapping_dict.equal[new_prop];
} }
return mapProperty(new_mapping_dict, key, value, for_value); return mapProperty(new_mapping_dict, key, value, for_value, isQuery);
} }
if (_mapping_dict.regex !== undefined || _mapping_dict.regexps) { if (_mapping_dict.regex !== undefined || _mapping_dict.regexps) {
...@@ -268,9 +268,6 @@ ...@@ -268,9 +268,6 @@
} }
for (k = 0; k < equalityArray.length; k = k + 1) { for (k = 0; k < equalityArray.length; k = k + 1) {
if (value === equalityArray[k]) { if (value === equalityArray[k]) {
if (isQuery === true) {
isQuery = _mapping_dict.multiEqual;
}
mapped_kv.key = key; mapped_kv.key = key;
mapped_kv.value = _mapping_dict.multiEqual[i].match_value; mapped_kv.value = _mapping_dict.multiEqual[i].match_value;
return mapped_kv; return mapped_kv;
...@@ -280,16 +277,20 @@ ...@@ -280,16 +277,20 @@
} }
mapped_kv.key = key; mapped_kv.key = key;
mapped_kv.value = _mapping_dict.default_value; mapped_kv.value = _mapping_dict.default_value;
if (isQuery === true) {
mapped_kv.value = _mapping_dict.multiEqual;
}
return mapped_kv; return mapped_kv;
} }
if (_mapping_dict["switch"] !== undefined) { if (_mapping_dict["switch"] !== undefined) {
if (_mapping_dict["switch"].hasOwnProperty(key)) { if (_mapping_dict["switch"].hasOwnProperty(key)) {
return mapProperty(_mapping_dict['switch'][key], key, value, true); return mapProperty(_mapping_dict['switch'][key], key, value,
true, isQuery);
} }
if (_mapping_dict["switch"].regexps) { if (_mapping_dict["switch"].regexps) {
new_mapping_dict.regexps = _mapping_dict["switch"].regexps; new_mapping_dict.regexps = _mapping_dict["switch"].regexps;
return mapProperty(new_mapping_dict, key, value, true); return mapProperty(new_mapping_dict, key, value, true, isQuery);
} }
mapped_kv.key = key; mapped_kv.key = key;
mapped_kv.value = value; mapped_kv.value = value;
...@@ -553,6 +554,22 @@ ...@@ -553,6 +554,22 @@
mapped_kv = mapProperty(context._mapping_dict[one_query.key], mapped_kv = mapProperty(context._mapping_dict[one_query.key],
one_query.key, one_query.value, false); one_query.key, one_query.value, false);
if (Array.isArray(mapped_kv.value) && mapped_kv.value.length) {
query_list = [];
for (j = 0; j < mapped_kv.value.length; j += 1) {
query_list.push(new SimpleQuery({
key: mapped_kv.key,
value: mapped_kv.value[j],
type: "simple"
}));
}
one_query = new ComplexQuery({
operator: "OR",
query_list: query_list,
type: "complex"
});
return one_query;
}
one_query.key = mapped_kv.key; one_query.key = mapped_kv.key;
one_query.value = mapped_kv.value; one_query.value = mapped_kv.value;
return one_query; return one_query;
......
...@@ -1556,7 +1556,7 @@ ...@@ -1556,7 +1556,7 @@
sort_on: [["title", "descending"]] sort_on: [["title", "descending"]]
}); });
}) })
.push(function (result) { .push(function (result) {
deepEqual(result, deepEqual(result,
{ {
"data": { "data": {
......
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