作者:无痕 | 来源:互联网 | 2023-05-17 11:42
iamtryingtorun2solrqueriesinsingleforloopforfetchingminimumandmaximumvalueofafie
i am trying to run 2 solr queries in single for loop for fetching minimum and maximum value of a field from same solr core. The first query is running fine, but, second query is running each time for value in last index of array. My code is like this :
我试图在单个for循环中运行2个solr查询,以从同一个solr核心获取字段的最小值和最大值。第一个查询运行正常,但是,第二个查询每次都在运行数组的最后一个索引中的值。我的代码是这样的:
router.route('/might_be_interested').post(function (req, res) {
var merchant_id = req.body.merchant_id;
var data_merchants = []
var count1 = 0;
var count2 = 0;
var data = [];
var final_data = [];
var myStrQuery1 = 'q=merchant_id%3A' + merchant_id + '&wt=json&indent=true&group=true&group.field=category';
client_product.search(myStrQuery1, function (err, merchant_categories) {
if (err) {
console.log(err);
return;
}
var no_of_categories = merchant_categories.grouped.category.groups.length;
for (var i = 0; i
Thanks in advance. Any suggestion will be appreciated.
提前致谢。任何建议将不胜感激。
2 个解决方案