Subversion Repositories SmartDukaan

Rev

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

Rev 20217 Rev 20219
Line 37... Line 37...
37
		autoSuggestUrl.addParameter("fl", "title,subCategoryId,category_id,category,subCategory,score");  //Fields to choose
37
		autoSuggestUrl.addParameter("fl", "title,subCategoryId,category_id,category,subCategory,score");  //Fields to choose
38
		autoSuggestUrl.addParameter("wt", "json"); 					  //Output format
38
		autoSuggestUrl.addParameter("wt", "json"); 					  //Output format
39
		autoSuggestUrl.addParameter("rows", "20");             //search limit for each grouped field or query 
39
		autoSuggestUrl.addParameter("rows", "20");             //search limit for each grouped field or query 
40
	}
40
	}
41
 
41
 
42
	public String getSuggestions(String search_text) throws URISyntaxException, IOException{
42
	public String getSuggestions(String search_text, String offset) throws URISyntaxException, IOException{
43
		autoSuggestUrl.setParameter("q", "suggest:("+search_text+")");
43
		autoSuggestUrl.setParameter("q", "suggest:("+search_text+")");
-
 
44
		if (offset!=null && !offset.isEmpty()){
-
 
45
			try{
-
 
46
				autoSuggestUrl.setParameter("start", offset);
-
 
47
			}
-
 
48
			catch(Exception e){
-
 
49
				;
-
 
50
			}
-
 
51
		}
44
		URL url = autoSuggestUrl.build().toURL();
52
		URL url = autoSuggestUrl.build().toURL();
45
		log.info("Search Url "+url.toString());
53
		log.info("Search Url "+url.toString());
46
		InputStream is = url.openStream();
54
		InputStream is = url.openStream();
47
		String jsonString;
55
		String jsonString;
48
		try{
56
		try{