Subversion Repositories SmartDukaan

Rev

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