Subversion Repositories SmartDukaan

Rev

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

Rev 12108 Rev 12141
Line 38... Line 38...
38
 
38
 
39
	private static HashMap<String, List<String>> categoriesChildren = null;
39
	private static HashMap<String, List<String>> categoriesChildren = null;
40
	private static Map<Long, String> categoryLabelMap = null;
40
	private static Map<Long, String> categoryLabelMap = null;
41
 
41
 
42
	private List<String> results;
42
	private List<String> results;
-
 
43
	private List<String> dealResults;
43
	private Map<String, Double> dynamicSearchMap;
44
	private Map<String, Double> dynamicSearchMap;
44
 
45
 
45
	/**
46
	/**
46
	 * 
47
	 * 
47
	 */
48
	 */
Line 146... Line 147...
146
    	
147
    	
147
    	log.info("Queried term:" + query);
148
    	log.info("Queried term:" + query);
148
    	SolrSearchService search = new SolrSearchService(URLEncoder.encode("\"" + query + "\"" + " OR " + query, "UTF-8"), fqrys, (page-1)*windowSize, windowSize, minPrice, maxPrice, sortOrder, sourceId, userinfo.isPrivateDealUser());
149
    	SolrSearchService search = new SolrSearchService(URLEncoder.encode("\"" + query + "\"" + " OR " + query, "UTF-8"), fqrys, (page-1)*windowSize, windowSize, minPrice, maxPrice, sortOrder, sourceId, userinfo.isPrivateDealUser());
149
 
150
 
150
    	this.results =  search.getResultMap(); 
151
    	this.results =  search.getResultMap(); 
-
 
152
    	this.dealResults =  search.getDealMap();    	
151
    	this.dynamicSearchMap = search.getDynamicPriceMap();
153
    	this.dynamicSearchMap = search.getDynamicPriceMap();
152
    	// Facets
154
    	// Facets
153
    	List<String> fqs = null;
155
    	List<String> fqs = null;
154
    	if (fqrys != null) {
156
    	if (fqrys != null) {
155
    		fqs = Arrays.asList(fqrys);
157
    		fqs = Arrays.asList(fqrys);
Line 208... Line 210...
208
	}
210
	}
209
 
211
 
210
 
212
 
211
	public Map<String, String> getSnippets() throws Exception {
213
	public Map<String, String> getSnippets() throws Exception {
212
        if(results != null){
214
        if(results != null){
213
            snippets = new HashMap<String, String>();   
215
    		snippets = new HashMap<String, String>();	
-
 
216
    		if(userinfo.isPrivateDealUser()) {
214
            for(String docId: results){
217
    			for(String docId: results){
-
 
218
	    			if(dealResults.contains(docId)) {
215
                String snippet = (String)SnippetCacheWrapper.getSnippet(CacheKeys.CATEGORY_SNIPPET_CACHE_KEY, docId, sourceId);
219
	    				String snippet = (String) SnippetCacheWrapper.getSnippet(CacheKeys.PRIVATE_DEAL_SNIPPET_KEY, docId, sourceId);
216
                if (snippet != null) {
220
	    				if (snippet != null) {
217
                    snippets.put(docId, snippet);
221
	    					snippets.put(docId, snippet);
218
                }
222
	    					continue;
219
            }
223
	    				}
-
 
224
	    			}
-
 
225
	    			String snippet = (String) SnippetCacheWrapper.getSnippet(CacheKeys.CATEGORY_SNIPPET_CACHE_KEY, docId, sourceId);
-
 
226
	    			if (snippet != null) {
-
 
227
	    				snippets.put(docId, snippet);
220
        }
228
	    			}
-
 
229
	    		} 
-
 
230
			} else {
-
 
231
				for(String docId: results){
-
 
232
					String snippet = (String) SnippetCacheWrapper.getSnippet(CacheKeys.CATEGORY_SNIPPET_CACHE_KEY, docId, sourceId);
-
 
233
					if (snippet != null) {
-
 
234
						snippets.put(docId, snippet);
-
 
235
					}
-
 
236
				} 
-
 
237
				
-
 
238
			}
-
 
239
    	}
221
        return snippets;
240
		return snippets;
222
    }
241
    }
223
	
242
	
224
    /**
243
    /**
225
     * 
244
     * 
226
     * @return
245
     * @return