Subversion Repositories SmartDukaan

Rev

Rev 2053 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2053 Rev 2778
Line 1... Line 1...
1
package in.shop2020.social.controllers;
1
package in.shop2020.social.controllers;
2
 
2
 
-
 
3
import in.shop2020.datalogger.SocialEventType;
3
import in.shop2020.social.services.SolrSearchService;
4
import in.shop2020.social.services.SolrSearchService;
4
import in.shop2020.social.utils.FileUtils;
5
import in.shop2020.social.utils.FileUtils;
5
import in.shop2020.social.utils.Utils;
6
import in.shop2020.social.utils.Utils;
-
 
7
import in.shop2020.utils.DataLogger;
6
 
8
 
7
import java.io.File;
9
import java.io.File;
8
import java.util.HashMap;
10
import java.util.HashMap;
9
import java.util.List;
11
import java.util.List;
10
import java.util.Map;
12
import java.util.Map;
Line 48... Line 50...
48
		snippets = new HashMap<String, String>();
50
		snippets = new HashMap<String, String>();
49
	}
51
	}
50
	
52
	
51
	// GET /Show Form
53
	// GET /Show Form
52
	public String index() {
54
	public String index() {
-
 
55
		DataLogger.logSocialData(SocialEventType.PHONES_I_OWN_VIEWED, "1000");
53
		return "index";
56
		return "index";
54
	}
57
	}
55
	
58
	
56
	public String create()	{
59
	public String create()	{
57
		if(this.request.getParameter("q") != null && ! this.request.getParameter("q").trim().isEmpty())	{
60
		if(this.request.getParameter("q") != null && ! this.request.getParameter("q").trim().isEmpty())	{
Line 62... Line 65...
62
			SolrSearchService search = new SolrSearchService(query, fqrys, facetDefIDs, (page - 1) * windowSize, windowSize, minPrice, maxPrice, categoryId, sortOrder);
65
			SolrSearchService search = new SolrSearchService(query, fqrys, facetDefIDs, (page - 1) * windowSize, windowSize, minPrice, maxPrice, categoryId, sortOrder);
63
			this.totalResults = search.getTotalResults();
66
			this.totalResults = search.getTotalResults();
64
			this.results = search.getResultMap();
67
			this.results = search.getResultMap();
65
			this.hasSearched = true;
68
			this.hasSearched = true;
66
		}
69
		}
-
 
70
		DataLogger.logSocialData(SocialEventType.PHONES_I_OWN_VIEWED, "1000");
67
		return "index";
71
		return "index";
68
	}
72
	}
69
 
73
 
70
    public List<String> getResults()	{
74
    public List<String> getResults()	{
71
    	return this.results;
75
    	return this.results;
Line 76... Line 80...
76
    }
80
    }
77
    
81
    
78
    public Map<String, String> getSnippets() throws Exception {
82
    public Map<String, String> getSnippets() throws Exception {
79
    	if(results != null)	{
83
    	if(results != null)	{
80
    		snippets = new HashMap<String, String>();
84
    		snippets = new HashMap<String, String>();
81
//    		snippets.put("1000468", FileUtils.read("/home/varungupta/snippets/SearchSnippet1.html"));
-
 
82
//    		snippets.put("1000534", FileUtils.read("/home/varungupta/snippets/SearchSnippet2.html"));
-
 
83
//    		snippets.put("1001211", FileUtils.read("/home/varungupta/snippets/SearchSnippet3.html"));
-
 
84
//    		snippets.put("1001223", FileUtils.read("/home/varungupta/snippets/SearchSnippet4.html"));
-
 
85
 
85
    		
86
    		for(String docId: results){
86
    		for(String docId: results){
87
	    		String html = FileUtils.read(Utils.EXPORT_ENTITIES_PATH + docId + File.separator + "PhonesIOwnSnippet.html");
87
	    		String html = FileUtils.read(Utils.EXPORT_ENTITIES_PATH + docId + File.separator + "PhonesIOwnSnippet.html");
88
				snippets.put(docId, html);
88
				snippets.put(docId, html);
89
			}
89
			}
90
    	}
90
    	}