Subversion Repositories SmartDukaan

Rev

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

Rev 6866 Rev 6931
Line 21... Line 21...
21
 
21
 
22
import org.apache.commons.lang.StringUtils;
22
import org.apache.commons.lang.StringUtils;
23
import org.apache.log4j.Logger;
23
import org.apache.log4j.Logger;
24
import org.apache.struts2.convention.annotation.Result;
24
import org.apache.struts2.convention.annotation.Result;
25
 
25
 
-
 
26
import com.google.gson.Gson;
-
 
27
 
26
 
28
 
27
/**
29
/**
28
 * @author rajveer
30
 * @author rajveer
29
 *
31
 *
30
 */
32
 */
Line 33... Line 35...
33
 
35
 
34
	private static final long serialVersionUID = -8392433517042806559L;
36
	private static final long serialVersionUID = -8392433517042806559L;
35
	private static Logger log = Logger.getLogger(Class.class);
37
	private static Logger log = Logger.getLogger(Class.class);
36
 
38
 
37
	private List<String> results;
39
	private List<String> results;
-
 
40
	private Map<String, Double> dynamicSearchMap;
38
 
41
 
39
	/**
42
	/**
40
	 * 
43
	 * 
41
	 */
44
	 */
42
	private Map<String, String> snippets;
45
	private Map<String, String> snippets;
Line 145... Line 148...
145
    	
148
    	
146
    	
149
    	
147
    	SolrSearchService search = new SolrSearchService(query, fqrys, facetDefIDs, (page-1)*windowSize, windowSize, minPrice, maxPrice, Utils.ROOT_CATEGORY, sortOrder, sourceId);
150
    	SolrSearchService search = new SolrSearchService(query, fqrys, facetDefIDs, (page-1)*windowSize, windowSize, minPrice, maxPrice, Utils.ROOT_CATEGORY, sortOrder, sourceId);
148
 
151
 
149
    	this.results =  search.getResultMap(); 
152
    	this.results =  search.getResultMap(); 
150
    	
153
    	this.dynamicSearchMap = search.getDynamicPriceMap();
151
    	// Facets
154
    	// Facets
152
    	List<String> fqs = null;
155
    	List<String> fqs = null;
153
    	if (fqrys != null) {
156
    	if (fqrys != null) {
154
    		fqs = Arrays.asList(fqrys);
157
    		fqs = Arrays.asList(fqrys);
155
    	}else {
158
    	}else {
156
    		fqs = new ArrayList<String>();
159
    		fqs = new ArrayList<String>();
157
    	}
160
    	}
158
    	
161
    	
159
		setFacet(fqs, search);
162
		setFacet(fqs, search);
160
    	
163
    	
-
 
164
		//If 
161
    	Map<String, Double> priceMap = search.getPriceStatsMap();
165
    	Map<String, Double> priceMap = search.getPriceStatsMap();
162
    	if(priceMap != null){
166
    	if(priceMap != null){
-
 
167
    		if (this.minPrice == null){
163
    		this.minPrice = priceMap.get("min");
168
    			this.minPrice = priceMap.get("min");
-
 
169
    		}
-
 
170
    		if(this.maxPrice == null) {
164
    		this.maxPrice = priceMap.get("max");
171
    			this.maxPrice = priceMap.get("max");
-
 
172
    		}
165
    	}else{
173
    	} else{
166
    		this.minPrice = 0.0;
174
    		this.minPrice = 0.0;
167
    		this.maxPrice = 0.0;
175
    		this.maxPrice = 0.0;
168
    	}
176
    	}
169
    	
177
    	
170
    	this.totalResults = search.getTotalResults();
178
    	this.totalResults = search.getTotalResults();
Line 325... Line 333...
325
    		}
333
    		}
326
    	}
334
    	}
327
    	
335
    	
328
    	return categoriesChildren;
336
    	return categoriesChildren;
329
    }
337
    }
-
 
338
    
-
 
339
	public String getDynamicSearchMap(){
-
 
340
    	if (this.dynamicSearchMap == null) {
-
 
341
    		return "{}";
-
 
342
    	} else {
-
 
343
    		return new Gson().toJson(this.dynamicSearchMap);
-
 
344
    	}
-
 
345
    }
330
}
346
}