Subversion Repositories SmartDukaan

Rev

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

Rev 3304 Rev 3320
Line 68... Line 68...
68
        
68
        
69
    	String[] fqrys = this.request.getParameterValues("fq");
69
    	String[] fqrys = this.request.getParameterValues("fq");
70
 
70
 
71
    	url = "?";
71
    	url = "?";
72
 
72
 
73
    	int length = 1;
-
 
74
    	
-
 
75
    	if(fqrys!= null){
-
 
76
    		length += fqrys.length;
-
 
77
    	}
-
 
78
    	
-
 
79
    	String[] newfqrys;
-
 
80
    	if(specialPageName.equals("Android")){
-
 
81
    		newfqrys = new String[length];
-
 
82
    	}
-
 
83
    	else {
-
 
84
    		newfqrys = new String[length+1];
-
 
85
    	}
-
 
86
    	
-
 
87
    	if(specialPageName.equals("Android")){
-
 
88
    		newfqrys[0] = "F_50010:" + "(\"Mobile Phones\") OR Tablets";
-
 
89
    	}
-
 
90
    	else {
-
 
91
    		newfqrys[0] = "F_50001:" + specialPageName;
-
 
92
    		newfqrys[length] = "F_50010:" + "(\"Mobile Phones\") OR Tablets";
-
 
93
    	}
-
 
94
 
-
 
95
    	String urlCrumb = url;
73
    	String urlCrumb = url;
96
    	
74
    	
97
    	this.crumbs = new ArrayList<String[]>();
75
    	this.crumbs = new ArrayList<String[]>();
98
    	List<String> arrList = Arrays.asList(facetDefIDs);
76
    	List<String> arrList = Arrays.asList(facetDefIDs);
-
 
77
    	
99
    	for(int i=1; i<length; i++) {
78
    	if(fqrys!= null){
100
    		newfqrys[i] = fqrys[i-1];
79
    		for(int i=0; i<fqrys.length; i++) {
101
    		urlCrumb += "&fq=" + URLEncoder.encode(fqrys[i-1], "UTF-8");
80
        		urlCrumb += "&fq=" + URLEncoder.encode(fqrys[i], "UTF-8");
102
    		priceUrl += "&fq=" + URLEncoder.encode(fqrys[i-1], "UTF-8");
81
        		priceUrl += "&fq=" + URLEncoder.encode(fqrys[i], "UTF-8");
103
    		String filterUrl = url;
82
        		String filterUrl = url;
104
    		String facetName = StringUtils.split(fqrys[i-1], ":")[0];
83
        		String facetName = StringUtils.split(fqrys[i], ":")[0];
105
    		String facetValue = StringUtils.split(fqrys[i-1], ":")[1];
84
        		String facetValue = StringUtils.split(fqrys[i], ":")[1];
106
    		String facetLabel = facetLabels[arrList.indexOf(facetName)];
85
        		String facetLabel = facetLabels[arrList.indexOf(facetName)];
107
    		this.specialPageTitle += " | " + facetLabel + " " + facetValue;
86
        		this.specialPageTitle += " | " + facetLabel + " " + facetValue;
108
    		this.facetSelection += facetValue + " ";
87
        		this.facetSelection += facetValue + " ";
109
    		for(int j=1; j<length; j++) {
88
        		for(int j=0; j<fqrys.length; j++) {
110
    			if(i==j){
89
        			if(i==j){
111
    				continue;
90
        				continue;
112
    			}
91
        			}
113
    			filterUrl += "&fq=" + URLEncoder.encode(fqrys[j-1], "UTF-8");
92
        			filterUrl += "&fq=" + URLEncoder.encode(fqrys[j], "UTF-8");
114
	    	}
93
    	    	}
115
    		String[] acrumb = new String[] { facetLabel, facetValue, filterUrl };
94
        		String[] acrumb = new String[] { facetLabel, facetValue, filterUrl };
116
    		log.info("acrumb=" + Arrays.toString(acrumb));
95
        		log.info("acrumb=" + Arrays.toString(acrumb));
117
    		this.crumbs.add(acrumb);
96
        		this.crumbs.add(acrumb);
-
 
97
        	}
118
    	}
98
    	}
-
 
99
    	
119
 
100
    	
120
		url = urlCrumb;
101
		url = urlCrumb;
121
 
102
 
122
    	if(this.request.getParameter("page") != null){
103
    	if(this.request.getParameter("page") != null){
123
    		this.page = Long.parseLong(this.request.getParameter("page"));
104
    		this.page = Long.parseLong(this.request.getParameter("page"));
124
    		this.beginIndex = this.windowSize * (this.page-1);
105
    		this.beginIndex = this.windowSize * (this.page-1);
Line 134... Line 115...
134
    		url= url + "&maxPrice=" + this.request.getParameter("maxPrice");
115
    		url= url + "&maxPrice=" + this.request.getParameter("maxPrice");
135
    	}
116
    	}
136
 
117
 
137
    	query = query + "&sort=F_50002+asc";
118
    	query = query + "&sort=F_50002+asc";
138
 
119
 
139
    	SolrSearchService search = new SolrSearchService(query, newfqrys, facetDefIDs, (page-1)*windowSize, windowSize, minPrice, maxPrice, 10000, null);
120
    	SolrSearchService search = new SolrSearchService(query, fqrys, facetDefIDs, (page-1)*windowSize, windowSize, minPrice, maxPrice, 10000, null);
140
    	this.results =  search.getResultMap(); 
121
    	this.results =  search.getResultMap(); 
141
 
122
 
142
    	
123
    	
143
    	this.facets = new LinkedHashMap<String, List<String[]>>();
124
    	this.facets = new LinkedHashMap<String, List<String[]>>();
144
    	String qryString = this.request.getQueryString();
125
    	String qryString = this.request.getQueryString();
Line 152... Line 133...
152
    			continue;
133
    			continue;
153
    		List<String[]> values = new ArrayList<String[]>();
134
    		List<String[]> values = new ArrayList<String[]>();
154
    		String drilldownURL = url + "&fq=" + facetDefID + ":";
135
    		String drilldownURL = url + "&fq=" + facetDefID + ":";
155
    		for(Entry<String, Integer> facetEntry: facetDetailMap.entrySet()){
136
    		for(Entry<String, Integer> facetEntry: facetDetailMap.entrySet()){
156
    		    String facet = facetEntry.getKey();
137
    		    String facet = facetEntry.getKey();
157
    			drilldownURL = drilldownURL  + URLEncoder.encode(facet, "UTF-8");
-
 
158
 
138
 
159
    			String[] afacet = new String[] { facet, 
139
    			String[] afacet = new String[] { facet, 
160
      					facetEntry.getValue().toString(), drilldownURL  };
140
      					facetEntry.getValue().toString(), drilldownURL  + URLEncoder.encode(facet, "UTF-8")  };
161
 
141
 
162
      			values.add(afacet);
142
      			values.add(afacet);
163
    		}
143
    		}
164
    		
144
    		
165
    		this.facets.put(facetLabel, values);
145
    		this.facets.put(facetLabel, values);