Subversion Repositories SmartDukaan

Rev

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

Rev 20266 Rev 20277
Line 194... Line 194...
194
		try{
194
		try{
195
			log.info("Calling solr service (search results) for search_text "+search_text);
195
			log.info("Calling solr service (search results) for search_text "+search_text);
196
			String jsonString = s.getSearchResults(search_text.trim(), offset);
196
			String jsonString = s.getSearchResults(search_text.trim(), offset);
197
			JsonArray result_json = Json.parse(jsonString).asObject().get("response").asObject().get("docs").asArray();
197
			JsonArray result_json = Json.parse(jsonString).asObject().get("response").asObject().get("docs").asArray();
198
			for (JsonValue j : result_json ){
198
			for (JsonValue j : result_json ){
199
				j.asObject().add("productUrl", j.asObject().get("id").asString()+"/"+j.asObject().get("skuBundleId").asInt());
199
				j.asObject().add("productUrl", j.asObject().get("ids").asArray().get(0)+"/"+j.asObject().get("id"));
200
			}
200
			}
201
			setResultJson(result_json.toString());
201
			setResultJson(result_json.toString());
202
		}
202
		}
203
		catch(Exception e){
203
		catch(Exception e){
204
			e.printStackTrace();
204
			e.printStackTrace();
Line 220... Line 220...
220
 
220
 
221
 
221
 
222
	public static void main(String[] args) throws URISyntaxException, IOException{
222
	public static void main(String[] args) throws URISyntaxException, IOException{
223
		SolrSearchController a = new SolrSearchController();
223
		SolrSearchController a = new SolrSearchController();
224
		a.setSearch_text("iphone tempered");
224
		a.setSearch_text("iphone tempered");
-
 
225
		a.setOffset("10");
225
		a.getSuggestions();
226
		a.getSearchResults();
226
		System.out.println(a.getResultJson());
227
		System.out.println(a.getResultJson());
227
	}
228
	}
228
 
229
 
229
 
230
 
230
	public void setOffset(String offset) {
231
	public void setOffset(String offset) {