MCPcopy Create free account
hub / github.com/appbaseio/mirage / buildQuery

Method buildQuery

app/queryBlocks/queryBlocks.component.ts:145–336  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

143
144 // builquery - this function handles everything to build the query
145 buildQuery() {
146 var self = this;
147 var results = this.result.resultQuery.result;
148 var es_final = {};
149
150 if (results.length) {
151 var finalresult = {};
152 if (results.length > 1) {
153 es_final["query"] = {
154 bool: finalresult
155 };
156 } else {
157 if (results[0].availableQuery && results[0].internal.length > 1) {
158 es_final["query"] = {
159 bool: finalresult
160 };
161 } else {
162 if (self.queryList["boolQuery"][results[0]["boolparam"]] === "must") {
163 es_final["query"] = finalresult;
164 } else {
165 es_final["query"] = {
166 bool: finalresult
167 };
168 }
169 }
170 }
171
172 results.forEach(function(result) {
173 result.availableQuery = self.buildInsideQuery(result);
174 });
175 var isBoolPresent = true;
176
177 results.forEach(function(result0) {
178 results.forEach(function(result1) {
179 if (result1.parent_id == result0.id) {
180 var current_query = {
181 bool: {}
182 };
183 var currentBool = self.queryList["boolQuery"][result1["boolparam"]];
184 current_query["bool"][currentBool] = result1.availableQuery;
185 if (currentBool === "should") {
186 current_query["bool"]["minimum_should_match"] =
187 result1.minimum_should_match;
188 }
189 if (self.joiningQuery[self.joiningQueryParam] === "nested") {
190 current_query["bool"]["nested"]["path"] = result1.path;
191 current_query["bool"]["nested"]["score_mode"] =
192 result1.score_mode;
193 isBoolPresent = false;
194 }
195 result0.availableQuery.push(current_query);
196 }
197 });
198 });
199 results.forEach(function(result) {
200 if (result.parent_id === 0) {
201 var currentBool = self.queryList["boolQuery"][result["boolparam"]];
202 if (

Callers 12

addBoolQueryMethod · 0.95
removeQueryMethod · 0.95
removeSortBlockMethod · 0.95
addQueryMethod · 0.95
setJoiningQueryEveMethod · 0.95
getQueryFormatMethod · 0.80
removeQueryMethod · 0.80
queryCallbackMethod · 0.80
exeBuildMethod · 0.80
removeInQueryMethod · 0.80
exeBuildMethod · 0.80
exeBuildMethod · 0.80

Calls 2

buildInsideQueryMethod · 0.80
setValueMethod · 0.80

Tested by

no test coverage detected