Subversion Repositories SmartDukaan

Rev

Rev 33460 | Rev 33499 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
31604 tejbeer 1
package com.spice.profitmandi.dao.service.solr;
2
 
33245 ranu 3
import com.google.gson.Gson;
4
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
5
import com.spice.profitmandi.dao.entity.catalog.TagListing;
6
import com.spice.profitmandi.dao.entity.catalog.TagRanking;
7
import com.spice.profitmandi.dao.entity.dtr.WebProductListing;
8
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
9
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
10
import com.spice.profitmandi.dao.repository.dtr.Mongo;
11
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
12
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
13
import com.spice.profitmandi.service.tag.ItemTagModel;
14
import in.shop2020.model.v1.catalog.status;
31604 tejbeer 15
import org.apache.logging.log4j.LogManager;
16
import org.apache.logging.log4j.Logger;
17
import org.apache.solr.client.solrj.SolrClient;
18
import org.apache.solr.client.solrj.impl.HttpSolrClient;
19
import org.apache.solr.common.SolrInputDocument;
20
import org.json.JSONArray;
21
import org.json.JSONException;
22
import org.json.JSONObject;
23
import org.springframework.beans.factory.annotation.Autowired;
31613 tejbeer 24
import org.springframework.beans.factory.annotation.Value;
31604 tejbeer 25
import org.springframework.stereotype.Component;
26
 
33245 ranu 27
import java.io.BufferedReader;
28
import java.io.IOException;
29
import java.io.InputStream;
30
import java.io.InputStreamReader;
31
import java.net.HttpURLConnection;
32
import java.net.URL;
33
import java.net.URLConnection;
34
import java.time.ZoneId;
35
import java.util.*;
36
import java.util.Map.Entry;
37
import java.util.stream.Collectors;
38
import java.util.zip.GZIPInputStream;
31604 tejbeer 39
 
40
@Component
41
public class FofoSolr {
42
 
43
	@Autowired
44
	private Gson gson;
45
 
46
	@Autowired
47
	private TagListingRepository tagListingRepository;
48
 
49
	@Autowired
50
	TagRankingRepository tagRankingRepository;
51
 
52
	@Autowired
53
	private Mongo contentMongoClient;
54
 
31612 tejbeer 55
	@Autowired
56
	private WebListingRepository webListingRepository;
57
 
58
	@Autowired
59
	private WebProductListingRepository webProductListingRepository;
60
 
31613 tejbeer 61
	@Value("${new.solr.url}")
62
	private String solrUrl;
63
 
33486 amit.gupta 64
	@Value("${reportico.url}")
65
	private String reporticoUrl;
66
 
31604 tejbeer 67
	private static final Logger logger = LogManager.getLogger(FofoSolr.class);
68
 
69
	private static final List<Integer> CATEGORY_MASTER = Arrays.asList(10006, 10010, 14202, 14203);
70
 
33486 amit.gupta 71
	String solrPath = "http://" + solrUrl + ":8984/solr/demo";
31604 tejbeer 72
	String mongoHost = "localhost";
73
	SolrClient solr = new HttpSolrClient.Builder(solrPath).build();
74
 
75
	private String getAvailabilityJSON() {
33486 amit.gupta 76
		String url = reporticoUrl + "?execute_mode=EXECUTE&xmlin=warehousecisnew.xml&project=FOCOR&project_password=focor&target_format=JSON";
31604 tejbeer 77
		return getUrlContent(url);
78
	}
79
 
80
	private String getPendingPOJSON() {
33486 amit.gupta 81
		String url = reporticoUrl + "?execute_mode=EXECUTE&xmlin=UnfulfilledPOItemsNew.xml&project=FOCOR&project_password=focor&target_format=JSON";
31604 tejbeer 82
		return getUrlContent(url);
83
	}
84
 
85
	private static String getUrlContent(String urlString) {
86
		BufferedReader reader = null;
87
		try {
88
			URL url = new URL(urlString);
89
			URLConnection conn = url.openConnection();
90
			conn.setConnectTimeout(5000);
91
			conn.setReadTimeout(5000);
92
			reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
93
			return reader.lines().collect(Collectors.joining(System.lineSeparator()));
94
		} catch (IOException e) {
95
			e.printStackTrace();
96
		} finally {
97
			if (reader != null) {
98
				try {
99
					reader.close();
100
				} catch (IOException e) {
101
					e.printStackTrace();
102
				}
103
			}
104
		}
105
		return null;
106
	}
107
 
108
	public JSONArray getAvailability() throws IOException, JSONException {
33486 amit.gupta 109
		String url = reporticoUrl + "?execute_mode=EXECUTE&xmlin=warehousecisnew.xml&project=FOCOR&project_password=focor&target_format=JSON";
31604 tejbeer 110
		HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
111
		connection.setRequestProperty("Accept-Encoding", "gzip");
112
		BufferedReader reader = null;
113
 
114
		try {
115
			InputStream inputStream = connection.getInputStream();
116
 
117
			if ("gzip".equals(connection.getContentEncoding())) {
118
				inputStream = new GZIPInputStream(inputStream);
119
			}
120
 
121
			reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
122
			StringBuilder responseBuilder = new StringBuilder();
123
			String line;
124
 
125
			while ((line = reader.readLine()) != null) {
126
				responseBuilder.append(line);
127
			}
128
 
129
			JSONObject responseJson = new JSONObject(responseBuilder.toString());
130
			return responseJson.getJSONArray("data");
131
		} finally {
132
			if (reader != null) {
133
				try {
134
					reader.close();
135
				} catch (IOException e) {
136
					// Ignore
137
				}
138
			}
139
		}
140
	}
141
 
142
	public JSONArray getPendingPO() throws IOException, JSONException {
33486 amit.gupta 143
		String url = reporticoUrl+"?execute_mode=EXECUTE&xmlin=UnfulfilledPOItemsNew.xml&project=FOCOR&project_password=focor&target_format=JSON";
31604 tejbeer 144
		HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
145
		connection.setRequestProperty("Accept-Encoding", "gzip");
146
		BufferedReader reader = null;
147
 
148
		try {
149
			InputStream inputStream = connection.getInputStream();
150
 
151
			if ("gzip".equals(connection.getContentEncoding())) {
152
				inputStream = new GZIPInputStream(inputStream);
153
			}
154
 
155
			reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
156
			StringBuilder responseBuilder = new StringBuilder();
157
			String line;
158
 
159
			while ((line = reader.readLine()) != null) {
160
				responseBuilder.append(line);
161
			}
162
 
163
			JSONObject responseJson = new JSONObject(responseBuilder.toString());
164
			return responseJson.getJSONArray("data");
165
		} finally {
166
			if (reader != null) {
167
				try {
168
					reader.close();
169
				} catch (IOException e) {
170
					// Ignore
171
				}
172
			}
173
		}
174
	}
175
 
176
	public Map<String, Map<String, Map<String, Integer>>> getItemMap() throws Exception {
177
		JSONArray availabilityJSONArray = this.getAvailability();
178
		JSONArray pendingPOJSONArray = this.getPendingPO();
179
		Map<String, Map<String, Map<String, Integer>>> availabilityItemMap = new HashMap<>();
180
 
181
		for (int i = 0; i < availabilityJSONArray.length(); i++) {
182
			JSONObject rawAvailability = availabilityJSONArray.getJSONObject(i);
183
			if (!availabilityItemMap.containsKey(rawAvailability.getString("Itemid"))) {
184
				availabilityItemMap.put(rawAvailability.getString("Itemid"),
185
						new HashMap<String, Map<String, Integer>>());
186
			}
187
			if (!availabilityItemMap.get(rawAvailability.getString("Itemid"))
188
					.containsKey(rawAvailability.getString("Warehouseid"))) {
189
				availabilityItemMap.get(rawAvailability.getString("Itemid"))
190
						.put(rawAvailability.getString("Warehouseid"), new HashMap<String, Integer>());
191
				availabilityItemMap.get(rawAvailability.getString("Itemid"))
192
						.get(rawAvailability.getString("Warehouseid")).put("netAvailability", 0);
193
				availabilityItemMap.get(rawAvailability.getString("Itemid"))
194
						.get(rawAvailability.getString("Warehouseid")).put("netPo", 0);
195
			}
196
			int netAvailability = availabilityItemMap.get(rawAvailability.getString("Itemid"))
197
					.get(rawAvailability.getString("Warehouseid")).get("netAvailability")
198
					+ rawAvailability.getInt("Netavailability");
199
			availabilityItemMap.get(rawAvailability.getString("Itemid")).get(rawAvailability.getString("Warehouseid"))
200
					.put("netAvailability", netAvailability);
201
		}
202
 
203
		for (int i = 0; i < pendingPOJSONArray.length(); i++) {
204
			JSONObject rawPendingPo = pendingPOJSONArray.getJSONObject(i);
205
 
206
			String itemId = rawPendingPo.getString("Itemid");
207
			String warehouseId = rawPendingPo.getString("Warehouseid");
208
			if (!availabilityItemMap.containsKey(itemId)) {
209
				availabilityItemMap.put(itemId, new HashMap<String, Map<String, Integer>>());
210
			}
211
			if (!availabilityItemMap.get(itemId).containsKey(warehouseId)) {
212
				availabilityItemMap.get(itemId).put(warehouseId, new HashMap<String, Integer>() {
213
					{
214
						put("netAvailability", 0);
215
						put("netPo", 0);
216
					}
217
				});
218
			}
219
			availabilityItemMap.get(itemId).get(warehouseId).put("netPo",
220
					availabilityItemMap.get(itemId).get(warehouseId).get("netPo") + rawPendingPo.getInt("Unfulfilled"));
221
 
222
		}
223
		return availabilityItemMap;
224
 
225
	}
226
 
33245 ranu 227
    public Map<Integer, List<String>> getLabels() throws ProfitMandiBusinessException {
31634 tejbeer 228
		List<String> labels = Arrays.asList("partner-best-sellers", "partner-price-drop", "new-launches",
229
				"upgrade-offer", "special-support");
31612 tejbeer 230
 
231
		Map<Integer, String> webListing = webListingRepository.selectByUrls(labels).stream()
232
				.collect(Collectors.toMap(x -> x.getId(), x -> x.getUrl()));
233
 
234
		Map<Integer, List<WebProductListing>> webProductListingMap = webProductListingRepository
235
				.selectAllByWebListingIds(new ArrayList<>(webListing.keySet())).stream()
236
				.collect(Collectors.groupingBy(x -> x.getWebListingId()));
237
 
238
		Map<Integer, List<String>> catalogLabelMap = new HashMap<>();
239
		for (Entry<Integer, List<WebProductListing>> webProductListingEntry : webProductListingMap.entrySet()) {
240
 
241
			for (WebProductListing webProduct : webProductListingEntry.getValue()) {
242
 
243
				if (!catalogLabelMap.containsKey(webProduct.getEntityId())) {
244
 
245
					catalogLabelMap.put(webProduct.getEntityId(), new ArrayList<>());
246
 
247
				}
248
 
249
				List<String> itemLabels = catalogLabelMap.get(webProduct.getEntityId());
250
				itemLabels.add(webListing.get(webProduct.getWebListingId()));
251
				catalogLabelMap.put(webProduct.getEntityId(), itemLabels);
252
 
253
			}
254
 
255
		}
256
 
257
		return catalogLabelMap;
258
	}
259
 
31620 tejbeer 260
	public void populateTagItems() throws Exception {
31604 tejbeer 261
		Map<String, Map<String, Map<String, Integer>>> availabilityItemMap = getItemMap();
262
		List<TagRanking> tagRankingList = tagRankingRepository.getAllTagRanking();
263
		List<Integer> rankingList = new ArrayList<>();
264
		Map<Integer, String> featureMap = new HashMap<>();
265
		for (TagRanking tagRanking : tagRankingList) {
266
			rankingList.add(tagRanking.getCatalogItemId());
267
			featureMap.put(tagRanking.getCatalogItemId(), tagRanking.getFeature());
268
		}
269
		Map<Integer, Map<String, Object>> catalogMap = new HashMap<>();
270
 
31612 tejbeer 271
		List<status> statuses = Arrays.asList(status.ACTIVE, status.PAUSED_BY_RISK, status.PARTIALLY_ACTIVE);
272
 
273
		Map<Integer, List<String>> catalogLabelMap = this.getLabels();
274
 
275
		logger.info("catalogLabelMap {}", catalogLabelMap);
276
 
277
		/*
278
		 * List<ItemTagModel> tuples =
279
		 * tagListingRepository.getAllItemTagByStatus(statuses).stream() .filter(x ->
280
		 * x.getItem().getCatalogItemId() == 1023747).collect(Collectors.toList());
281
		 */
282
 
31604 tejbeer 283
		List<ItemTagModel> tuples = tagListingRepository.getAllItemTagByStatus(statuses);
284
 
285
		Map<String, Object> projection = new HashMap<>();
286
		projection.put("defaultImageUrl", 1);
287
 
31710 tejbeer 288
		List<String> excludeBrands = Arrays.asList("Dummy", "FOC HANDSET");
31604 tejbeer 289
 
290
		for (ItemTagModel result : tuples) {
291
			TagListing tag = result.getTagListing();
292
			com.spice.profitmandi.dao.entity.catalog.Item item = result.getItem();
293
			if (excludeBrands.contains(item.getBrand())) {
294
				continue;
295
			}
296
 
297
			if (!catalogMap.containsKey(item.getCatalogItemId())) {
298
				Map<String, Object> catalogObj = new HashMap<>();
299
				catalogObj.put("feature", "");
31641 tejbeer 300
				catalogObj.put("hsnCode", item.getHsnCode());
31604 tejbeer 301
				catalogObj.put("title",
302
						String.join(" ", Arrays.asList(item.getBrand(), item.getModelName(), item.getModelNumber())
303
								.stream().filter(s -> s != null && !s.isEmpty()).collect(Collectors.toList())));
31612 tejbeer 304
				catalogObj.put("brand", new String[] { item.getBrand() });
31604 tejbeer 305
				if (item.getBrand().equals("Huawei") || item.getBrand().equals("Honor")) {
306
					catalogObj.put("brand", new String[] { "Huawei", "Honor" });
307
				}
308
				if (item.getBrand().equals("Mi") || item.getBrand().equals("Xiaomi")
309
						|| item.getBrand().equals("Redmi")) {
310
					catalogObj.put("brand", new String[] { "Mi", "Xiaomi", "Redmi" });
311
				}
312
				catalogObj.put("identifier", item.getCatalogItemId());
313
				catalogObj.put("items", new HashMap<Integer, Map<String, Object>>());
314
				Map<String, Object> filterMap = new HashMap<>();
315
				filterMap.put("_id", item.getCatalogItemId());
316
				// Don't include if catalog not available
317
				try {
31620 tejbeer 318
					String imageUrl = contentMongoClient.getEntityById(item.getCatalogItemId()).getDefaultImageUrl();
31604 tejbeer 319
 
31620 tejbeer 320
					if (imageUrl != null) {
321
						catalogObj.put("imageUrl", imageUrl);
322
					} else {
323
						catalogObj.put("imageUrl",
324
								"https://images.smartdukaan.com/uploads/campaigns/" + item.getCatalogItemId() + ".jpg");
325
					}
31604 tejbeer 326
				} catch (Exception e) {
327
					try {
328
						catalogObj.put("imageUrl",
329
								"https://images.smartdukaan.com/uploads/campaigns/" + item.getCatalogItemId() + ".jpg");
330
					} catch (Exception e2) {
331
						e2.printStackTrace();
332
					}
333
				}
334
				try {
335
					catalogObj.put("rank", rankingList.indexOf(item.getCatalogItemId()));
336
				} catch (Exception e) {
337
					// A very big number
338
					e.printStackTrace();
339
					catalogObj.put("rank", 50000000);
340
				}
341
				if (featureMap.containsKey(item.getCatalogItemId())
342
						&& featureMap.get(item.getCatalogItemId()) != null) {
343
					catalogObj.put("feature", featureMap.get(item.getCatalogItemId()));
344
 
345
				}
346
 
31634 tejbeer 347
				catalogObj.put("categoryId", CATEGORY_MASTER.contains(item.getCategoryId()) ? item.getCategoryId() : 6);
31624 tejbeer 348
 
31604 tejbeer 349
				if (item.getCategoryId() == 10006) {
350
					catalogObj.put("categoryId", 3);
351
				}
352
				catalogObj.put("subCategoryId", item.getCategoryId());
31612 tejbeer 353
				catalogObj.put("create_timestamp",
354
						tag.getCreatedTimestamp().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
355
 
356
				if (catalogLabelMap.containsKey(item.getCatalogItemId())
357
						&& catalogLabelMap.get(item.getCatalogItemId()) != null) {
358
					catalogObj.put("labels", catalogLabelMap.get(item.getCatalogItemId()));
359
 
360
				}
31604 tejbeer 361
				catalogMap.put(item.getCatalogItemId(), catalogObj);
362
				catalogObj.put("avColor", new HashMap<>());
31612 tejbeer 363
 
31604 tejbeer 364
			}
365
 
366
			Map<String, Object> catalogObj = catalogMap.get(item.getCatalogItemId());
367
			Map<Integer, Integer> avColorMap = (Map<Integer, Integer>) catalogObj.get("avColor");
368
 
369
			if (availabilityItemMap.containsKey(String.valueOf(item.getId()))) {
370
				for (Map.Entry<String, Map<String, Integer>> entry : availabilityItemMap
371
						.get(String.valueOf(item.getId())).entrySet()) {
372
					String warehouseId = entry.getKey();
373
					Map<String, Integer> avMap = entry.getValue();
374
					if (!avColorMap.containsKey(Integer.parseInt(warehouseId))) {
375
						avColorMap.put(Integer.parseInt(warehouseId), 0);
376
					}
377
					int color = avColorMap.get(Integer.parseInt(warehouseId));
378
 
379
					if (avMap.get("netAvailability") > 0) {
380
						color = 2;
381
					} else if (avMap.get("netAvailability") + avMap.get("netPo") > 0) {
382
						color = Math.max(color, 1);
383
					} else {
384
						color = Math.max(color, 0);
385
					}
386
					avColorMap.put(Integer.parseInt(warehouseId), color);
387
 
388
					catalogObj.put("avColor", avColorMap);
389
 
390
				}
391
 
392
			}
393
 
394
			Map<Integer, Object> itemColorMap = (Map<Integer, Object>) catalogObj.get("items");
395
 
396
			if (!itemColorMap.containsKey(item.getId())) {
397
				itemColorMap.put(item.getId(), new HashMap<String, Object>() {
398
					{
399
						put("color", item.getColor().replace("f_", ""));
400
						put("tagPricing", new ArrayList<TagListing>());
401
					}
402
				});
403
			}
404
			Map<String, Object> itemMap = (Map<String, Object>) itemColorMap.get(item.getId());
405
			List<TagListing> tagPricing = (List<TagListing>) itemMap.get("tagPricing");
406
			tagPricing.add(tag);
407
		}
408
 
409
		logger.info("catalogObj {}", catalogMap);
410
		List<SolrInputDocument> catalogSolrObjs = new ArrayList<>();
411
		for (Entry<Integer, Map<String, Object>> entry : catalogMap.entrySet()) {
412
			int catalogId = entry.getKey();
413
			Map<String, Object> catalogValMap = entry.getValue();
414
			Map<Integer, Object> itemsMap = (Map<Integer, Object>) catalogValMap.get("items");
415
 
416
			boolean active = false;
417
			// Map<Integer, Object> itemsMap = (Map<String, Object>)
418
			// catalogValMap.get("items");
419
			List<SolrInputDocument> itemObjs = new ArrayList<>();
420
			float mop = 0;
421
 
422
			for (Entry<Integer, Object> itemEntry : itemsMap.entrySet()) {
423
				int itemId = itemEntry.getKey();
424
				Map<String, Object> itemMap = (Map<String, Object>) itemEntry.getValue();
425
				List<TagListing> tags = (List<TagListing>) itemMap.get("tagPricing");
426
				SolrInputDocument itemObj = new SolrInputDocument();
427
 
428
				for (TagListing taglist : tags) {
429
					active = active || (Boolean) taglist.isActive();
430
					itemObj.setField("id", "itemtag-" + itemId + "-" + taglist.getTagId());
431
					itemObj.setField("color_s", itemMap.get("color"));
432
					itemObj.setField("itemId_i", itemId);
433
					itemObj.setField("tagId_i", taglist.getTagId());
434
					itemObj.setField("mrp_f", taglist.getMrp());
435
					itemObj.setField("mop_f", taglist.getMop());
436
					itemObj.setField("sellingPrice_f", taglist.getSellingPrice());
437
					itemObj.setField("active_b", taglist.isActive());
438
					itemObj.setField("hot_deal_b", taglist.isHotDeals());
439
					mop = taglist.getMop();
440
 
441
				}
442
 
443
				itemObjs.add(itemObj);
444
			}
445
 
446
			logger.info("catalogValMap {}", catalogValMap);
447
 
448
			logger.info("rank {}", catalogValMap.get("rank"));
449
 
450
			SolrInputDocument catalogSolrObj = new SolrInputDocument();
451
 
452
			catalogSolrObj.setField("id", "catalog" + catalogId);
453
			catalogSolrObj.setField("rank_i", catalogValMap.get("rank"));
454
			catalogSolrObj.setField("title_s", catalogValMap.get("title"));
31612 tejbeer 455
			// catalogSolrObj.setField("_childDocuments_", itemObjs);
31604 tejbeer 456
			catalogSolrObj.addChildDocuments(itemObjs);
31616 tejbeer 457
			catalogSolrObj.setField("child_b", itemObjs.size() > 0);
31604 tejbeer 458
			catalogSolrObj.setField("catalogId_i", catalogId);
459
			catalogSolrObj.setField("imageUrl_s",
460
					catalogValMap.get("imageUrl").toString().replace("saholic", "smartdukaan"));
461
			catalogSolrObj.setField("feature_s", catalogValMap.get("feature"));
462
			catalogSolrObj.setField("brand_ss", catalogValMap.get("brand"));
463
			catalogSolrObj.setField("create_s", catalogValMap.get("create_timestamp"));
464
			catalogSolrObj.setField("categoryId_i", catalogValMap.get("categoryId"));
465
			catalogSolrObj.setField("subCategoryId_i", catalogValMap.get("subCategoryId"));
31612 tejbeer 466
			catalogSolrObj.setField("label_ss", catalogValMap.get("labels"));
31604 tejbeer 467
			catalogSolrObj.setField("w7573_i", 0);
468
			catalogSolrObj.setField("w7678_i", 0);
469
			catalogSolrObj.setField("w7720_i", 0);
470
			catalogSolrObj.setField("w8468_i", 0);
471
			catalogSolrObj.setField("w8889_i", 0);
472
			catalogSolrObj.setField("w8947_i", 0);
473
			catalogSolrObj.setField("w9213_i", 0);
474
			catalogSolrObj.setField("w9203_i", 0);
475
			catalogSolrObj.setField("mop_f", mop);
31641 tejbeer 476
			catalogSolrObj.setField("hsncode_s", catalogValMap.get("hsnCode"));
31660 tejbeer 477
			catalogSolrObj.setField("show_default_b", true);
31612 tejbeer 478
 
479
			String[] brands = (String[]) catalogValMap.get("brand");
480
			for (String brand : brands) {
31660 tejbeer 481
				if (brand.equals("FOC")) {
482
					catalogSolrObj.setField("show_default_b", false);
31612 tejbeer 483
 
484
				}
31710 tejbeer 485
 
486
				if (brand.equals("Live Demo")) {
487
					catalogSolrObj.setField("show_default_b", false);
488
 
489
				}
31612 tejbeer 490
			}
31604 tejbeer 491
			Map<Integer, Integer> avColorMap = (Map<Integer, Integer>) catalogValMap.get("avColor");
492
 
493
			for (Entry<Integer, Integer> avColorEntry : avColorMap.entrySet()) {
494
				int whId = avColorEntry.getKey();
495
				int color = (int) avColorEntry.getValue();
496
				catalogSolrObj.setField("w" + whId + "_i", color);
497
			}
498
			catalogSolrObj.setField("active_b", active);
499
			logger.info("catalogSolrObj {}", catalogSolrObj.get("rank_i"));
500
			catalogSolrObjs.add(catalogSolrObj);
501
 
502
		}
503
 
504
		logger.info("catalogSolrObjs {}", catalogSolrObjs);
505
		solr.deleteByQuery("*:*");
506
		solr.add(catalogSolrObjs);
507
 
31612 tejbeer 508
		org.apache.solr.client.solrj.response.UpdateResponse updateResponse = solr.commit();
31604 tejbeer 509
		logger.info("solr {}", updateResponse.getStatus());
510
 
511
	}
512
 
513
	public void pushData() throws Exception {
514
		this.populateTagItems();
515
	}
516
}