Subversion Repositories SmartDukaan

Rev

Rev 26848 | Rev 26884 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26848 Rev 26883
Line 258... Line 258...
258
				mandatoryQ.add(String.format("+(%s)", queryTerm));
258
				mandatoryQ.add(String.format("+(%s)", queryTerm));
259
			} else {
259
			} else {
260
				queryTerm = null;
260
				queryTerm = null;
261
			}
261
			}
262
			if (subCategoryId != 0) {
262
			if (subCategoryId != 0) {
263
				mandatoryQ
-
 
264
						.add(String.format("+(subCategoryId_i:%s) +{!parent which=\"subCategoryId_i:%s\"} tagId_i:(%s)",
263
				mandatoryQ.add(String.format("{!parent which=\"subCategoryId_i:%s AND child_b:true\"}tagId_i:(%s)",
265
								subCategoryId, subCategoryId, StringUtils.join(tagIds, " ")));
264
						subCategoryId, StringUtils.join(tagIds, " ")));
266
			} else if (hotDeal) {
265
			} else if (hotDeal) {
267
				mandatoryQ.add(String.format("+{!parent which=\"hot_deals_b=true\"} tagId_i:(%s)",
266
				mandatoryQ.add(String.format("+{!parent which=\"hot_deals_b=true AND child_b:true\"}tagId_i:(%s)",
268
						StringUtils.join(tagIds, " ")));
267
						StringUtils.join(tagIds, " ")));
269
 
268
 
270
			} else if (StringUtils.isNotBlank(brand)) {
269
			} else if (StringUtils.isNotBlank(brand)) {
271
				mandatoryQ.add(
270
				mandatoryQ.add(String.format(
272
						String.format("+(categoryId_i:%s) +(brand_ss:%s) +{!parent which=\"brand_ss:%s\"} tagId_i:(%s)",
271
						"{!parent which=\"brand_ss:%s AND cateogryId_i:%s " + "AND child_b:true\"}tagId_i:(%s)", brand,
273
								categoryId, brand, brand, StringUtils.join(tagIds, " ")));
272
						categoryId, StringUtils.join(tagIds, " ")));
274
 
273
 
275
			} else {
274
			} else {
276
				mandatoryQ
-
 
277
						.add(String.format("+(subCategoryId_i:%s) +{!parent which=\"subCategoryId_i:%s\"} tagId_i:(%s)",
275
				mandatoryQ.add(String.format("{!parent which=\"subCategoryId_i:%s\"}tagId_i:(%s) AND child_b:true",
278
								categoryId, categoryId, StringUtils.join(tagIds, " ")));
276
						categoryId, StringUtils.join(tagIds, " ")));
279
			}
277
			}
280
			params.put("q", StringUtils.join(mandatoryQ, " "));
278
			params.put("q", StringUtils.join(mandatoryQ, " "));
281
			params.put("fl", "*, [child parentFilter=id:catalog*]");
279
			params.put("fl", "*, [child parentFilter=id:catalog*]");
282
			if (queryTerm == null) {
280
			if (queryTerm == null) {
283
				params.put("sort", "create_s desc");
281
				params.put("sort", "create_s desc");
Line 291... Line 289...
291
			} catch (HttpHostConnectException e) {
289
			} catch (HttpHostConnectException e) {
292
				throw new ProfitMandiBusinessException("", "", "Could not connect to host");
290
				throw new ProfitMandiBusinessException("", "", "Could not connect to host");
293
			}
291
			}
294
			JSONObject solrResponseJSONObj = new JSONObject(response).getJSONObject("response");
292
			JSONObject solrResponseJSONObj = new JSONObject(response).getJSONObject("response");
295
			JSONArray docs = solrResponseJSONObj.getJSONArray("docs");
293
			JSONArray docs = solrResponseJSONObj.getJSONArray("docs");
296
			dealResponse = getCatalogResponse(docs, hotDeal);
294
			dealResponse = this.getCatalogResponse(docs, hotDeal);
297
			/*
295
			/*
298
			 * if (Mongo.PARTNER_BLoCKED_BRANDS.containsKey(userInfo.getEmail())) {
296
			 * if (Mongo.PARTNER_BLoCKED_BRANDS.containsKey(userInfo.getEmail())) {
299
			 * dealResponse.stream() .filter(x ->
297
			 * dealResponse.stream() .filter(x ->
300
			 * Mongo.PARTNER_BLoCKED_BRANDS.get(userInfo.getEmail()).contains(x.getBrand()))
298
			 * Mongo.PARTNER_BLoCKED_BRANDS.get(userInfo.getEmail()).contains(x.getBrand()))
301
			 * ; }
299
			 * ; }