Subversion Repositories SmartDukaan

Rev

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

Rev 21291 Rev 21293
Line 60... Line 60...
60
		}
60
		}
61
		JsonArray result_json = Json.parse(jsonString).asObject().get("response").asObject().get("docs").asArray();
61
		JsonArray result_json = Json.parse(jsonString).asObject().get("response").asObject().get("docs").asArray();
62
		for (JsonValue j : result_json ){
62
		for (JsonValue j : result_json ){
63
			j.asObject().add("productUrl", j.asObject().get("ids").asArray().get(0)+"/"+j.asObject().get("id").asString());
63
			j.asObject().add("productUrl", j.asObject().get("ids").asArray().get(0)+"/"+j.asObject().get("id").asString());
64
		}
64
		}
-
 
65
		logger.info("Before creating response "+result_json);
65
		final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), ProfitMandiConstants.URL_SOLR_SEARCH , HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, (String)result_json.toString());
66
		final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), ProfitMandiConstants.URL_SOLR_SEARCH , HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, result_json.toString());
-
 
67
		logger.info("After creating response "+result_json.toString());
66
		return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
68
		return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
67
	}
69
	}
68
 
70
 
69
 
71
 
70
	@RequestMapping(value = ProfitMandiConstants.URL_SOLR_SUGGESTION, method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
72
	@RequestMapping(value = ProfitMandiConstants.URL_SOLR_SUGGESTION, method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
Line 82... Line 84...
82
			logger.error("Error while getting suggestions from solr",e);
84
			logger.error("Error while getting suggestions from solr",e);
83
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), ProfitMandiConstants.URL_SOLR_SUGGESTION , HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, new JsonArray().toString());
85
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), ProfitMandiConstants.URL_SOLR_SUGGESTION , HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, new JsonArray().toString());
84
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
86
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
85
		}
87
		}
86
		result_json = Json.parse(jsonString).asObject().get("grouped").asObject();
88
		result_json = Json.parse(jsonString).asObject().get("grouped").asObject();
-
 
89
		logger.info("Before creating response "+result_json);
87
		final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), ProfitMandiConstants.URL_SOLR_SUGGESTION , HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, sanatizedResults().toString());
90
		final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), ProfitMandiConstants.URL_SOLR_SUGGESTION , HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, sanatizedResults().toString());
-
 
91
		logger.info("After creating response "+result_json.toString());
88
		return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
92
		return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
89
	}
93
	}
90
 
94
 
91
	private JsonArray sanatizedResults(){
95
	private JsonArray sanatizedResults(){
92
 
96