Subversion Repositories SmartDukaan

Rev

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

Rev 3173 Rev 3242
Line 1... Line 1...
1
/**
1
/**
2
 * 
2
 * 
3
 */
3
 */
4
package in.shop2020.serving.controllers;
4
package in.shop2020.serving.controllers;
5
 
5
 
-
 
6
import in.shop2020.serving.cache.CategorySnippetCacheWrapper;
6
import in.shop2020.serving.services.SolrSearchService;
7
import in.shop2020.serving.services.SolrSearchService;
7
import in.shop2020.serving.utils.FileUtils;
-
 
8
import in.shop2020.serving.utils.Utils;
8
import in.shop2020.serving.utils.Utils;
9
import in.shop2020.utils.CategoryManager;
9
import in.shop2020.utils.CategoryManager;
10
 
10
 
11
import java.io.File;
-
 
12
import java.io.IOException;
11
import java.io.IOException;
13
import java.net.URLEncoder;
12
import java.net.URLEncoder;
14
import java.util.ArrayList;
13
import java.util.ArrayList;
15
import java.util.Arrays;
14
import java.util.Arrays;
16
import java.util.HashMap;
15
import java.util.HashMap;
Line 309... Line 308...
309
    public List<String[]> getCrumbs() {
308
    public List<String[]> getCrumbs() {
310
    	return this.crumbs;
309
    	return this.crumbs;
311
    }
310
    }
312
 
311
 
313
    public Map<String, String> getSnippets(){
312
    public Map<String, String> getSnippets(){
314
    	if(results != null){
313
        if(results != null){
315
    		snippets = new HashMap<String, String>();	
314
    		snippets = new HashMap<String, String>();	
316
	    	for(String docId: results){
315
	    	for(String docId: results){
317
				try {
-
 
318
					snippets.put(docId, FileUtils.read( Utils.EXPORT_ENTITIES_PATH + docId + File.separator +"CategorySnippet.html"));
316
	    	    String snippet = CategorySnippetCacheWrapper.getSnippet(docId);
319
				} catch (IOException e) {
317
	    	    if (snippet != null) {
320
					log.error(e);
318
	    	        snippets.put(docId, snippet);
321
				}
319
	    	    }
322
			}
320
			}
323
    	}
321
    	}
324
		return snippets;
322
		return snippets;
325
    }
323
    }
326
 
324