Subversion Repositories SmartDukaan

Rev

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

Rev 7228 Rev 7279
Line 343... Line 343...
343
            boolean domainOnce = true;
343
            boolean domainOnce = true;
344
            boolean sourceOnce = true;
344
            boolean sourceOnce = true;
345
            for(String domainPath : DOMAINPATHS){
345
            for(String domainPath : DOMAINPATHS){
346
            	String domainName = domainPath;
346
            	String domainName = domainPath;
347
            	String pathName = domainPath.split("\\.")[0].split(":")[0];
347
            	String pathName = domainPath.split("\\.")[0].split(":")[0];
-
 
348
            	//Special check for store.
-
 
349
            	if(!pathName.equals("store") || isStoreItem(items)){
348
            	minPrice = priceInserter.insertPriceInHtml(items, entityId,
350
	            	minPrice = priceInserter.insertPriceInHtml(items, entityId,
349
            			domainName, Utils.EXPORT_PATH + "html/entities-" +  pathName + "/", null);
351
	            			domainName, Utils.EXPORT_PATH + "html/entities-" +  pathName + "/", null);
350
            	if(domainOnce){
352
	            	if(domainOnce){
351
            		priceString.append("<field name=\"F_50002\">" + minPrice + "</field>");
353
	            		priceString.append("<field name=\"F_50002\">" + minPrice + "</field>");
352
            		availabilityString.append("<field name=\"F_50028\">" + availability + "</field>");
354
	            		availabilityString.append("<field name=\"F_50028\">" + availability + "</field>");
353
            		if(entityTags.containsKey(entityId)) {
355
	            		if(entityTags.containsKey(entityId)) {
354
            			List<String> tags = entityTags.get(entityId);
356
	            			List<String> tags = entityTags.get(entityId);
355
            			for(String tag: tags){
357
	            			for(String tag: tags){
356
            				availabilityString.append("\n<field name=\"F_50029\">" + tag + "</field>");
358
	            				availabilityString.append("\n<field name=\"F_50029\">" + tag + "</field>");
357
            			}
359
	            			}
358
            		}
360
	            		}
359
            		if(popularityMap.containsKey(entityId)) {
361
	            		if(popularityMap.containsKey(entityId)) {
360
            			availabilityString.append("\n<field name=\"F_50030\">" + popularityMap.get(entityId) + "</field>");
362
	            			availabilityString.append("\n<field name=\"F_50030\">" + popularityMap.get(entityId) + "</field>");
361
            		}else {
363
	            		}else {
362
            			availabilityString.append("\n<field name=\"F_50030\">" + "0" + "</field>");
364
	            			availabilityString.append("\n<field name=\"F_50030\">" + "0" + "</field>");
363
            		}
365
	            		}
364
            		domainOnce = false;
366
	            		domainOnce = false;
365
            	}
367
	            	}
366
            	if(sources != null){
368
	            	if(sources != null){
367
            		for (Source source : sources) {
369
	            		for (Source source : sources) {
368
                        minPrice = priceInserter.insertPriceInHtml(items, entityId,
370
	                        minPrice = priceInserter.insertPriceInHtml(items, entityId,
369
                                domainName, Utils.EXPORT_PATH + "html/entities-" + pathName + "/",
371
	                                domainName, Utils.EXPORT_PATH + "html/entities-" + pathName + "/",
370
                                source);
372
	                                source);
371
                        if(sourceOnce){
373
	                        if(sourceOnce){
372
                        	priceString.append("<field name=\"F_50002_"
374
	                        	priceString.append("<field name=\"F_50002_"
373
                                + source.getId() + "\">" + minPrice + "</field>");
375
	                                + source.getId() + "\">" + minPrice + "</field>");
374
                        }
376
	                        }
375
            		}
377
	            		}
376
            		sourceOnce = false;
378
	            		sourceOnce = false;
-
 
379
	            	}
377
            	}
380
            	}
378
            }
381
            }
379
 
382
 
380
            priceInserter.insertPriceInSolrData(entityId,
383
            priceInserter.insertPriceInSolrData(entityId,
381
                    priceString.toString(), availabilityString.toString());
384
                    priceString.toString(), availabilityString.toString());
Line 383... Line 386...
383
 
386
 
384
        priceInserter.copySolrSchemaFiles();
387
        priceInserter.copySolrSchemaFiles();
385
        synonymTitlesExporter();
388
        synonymTitlesExporter();
386
    }
389
    }
387
 
390
 
-
 
391
    private boolean isStoreItem(List<Item> items2) {
-
 
392
		for (Item item : items2){
-
 
393
			if(item.isActiveOnStore()) {
-
 
394
				return true;
-
 
395
			}
-
 
396
		}
-
 
397
		return false;
-
 
398
	}
-
 
399
 
388
    private Map<Long, Integer> getPolularityMap() {
400
	private Map<Long, Integer> getPolularityMap() {
389
		try {
401
		try {
390
			Reader reader = new FileReader(Utils.EXPORT_PATH + Utils.POPULARITY_JSON);
402
			Reader reader = new FileReader(Utils.EXPORT_PATH + Utils.POPULARITY_JSON);
391
			return new Gson().fromJson(reader, new TypeToken<Map<Long, Integer>>() {}.getType());
403
			return new Gson().fromJson(reader, new TypeToken<Map<Long, Integer>>() {}.getType());
392
		} catch (FileNotFoundException e) {
404
		} catch (FileNotFoundException e) {
393
			log.error("Could not read popularity file");
405
			log.error("Could not read popularity file");