Subversion Repositories SmartDukaan

Rev

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

Rev 27601 Rev 27603
Line 24... Line 24...
24
	@Value("${new.solr.url}")
24
	@Value("${new.solr.url}")
25
	private String solrUrl;
25
	private String solrUrl;
26
	
26
	
27
	@Autowired
27
	@Autowired
28
	private RestClient restClient;
28
	private RestClient restClient;
29
	public String getContent(String queryTerm, int categoryId, List<String> brands) throws Exception {
29
	public String getContent(String queryTerm, int categoryId, List<String> brands, int limit) throws Exception {
30
		Map<String, String> params = new HashMap<>();
30
		Map<String, String> params = new HashMap<>();
31
		List<String> mandatoryQ = new ArrayList<>();
31
		List<String> mandatoryQ = new ArrayList<>();
32
		if (queryTerm != null && !queryTerm.equals("null")) {
32
		if (queryTerm != null && !queryTerm.equals("null")) {
33
			mandatoryQ.add(String.format("+(%s)", "*"+queryTerm + "*"));
33
			mandatoryQ.add(String.format("+(%s)", "*"+queryTerm + "*"));
34
		} else {
34
		} else {
Line 44... Line 44...
44
		params.put("fl", "*");
44
		params.put("fl", "*");
45
		if (queryTerm == null) {
45
		if (queryTerm == null) {
46
			params.put("sort", "create_s desc");
46
			params.put("sort", "create_s desc");
47
		}
47
		}
48
		params.put("start", String.valueOf(0));
48
		params.put("start", String.valueOf(0));
-
 
49
		if(limit==0) {
-
 
50
			params.put("fl", "catalogId_i, title_s");
-
 
51
			params.put("rows", String.valueOf(5000));
-
 
52
		} else {
49
		params.put("rows", String.valueOf(20));
53
			params.put("rows", String.valueOf(20));
-
 
54
		}
50
		params.put("wt", "json");
55
		params.put("wt", "json");
51
		String response = null;
56
		String response = null;
52
		try {
57
		try {
53
			response = restClient.get(SchemeType.HTTP, solrUrl, 8984, "solr/demo/select", params);
58
			response = restClient.get(SchemeType.HTTP, solrUrl, 8984, "solr/demo/select", params);
54
		} catch (HttpHostConnectException e) {
59
		} catch (HttpHostConnectException e) {