Subversion Repositories SmartDukaan

Rev

Rev 3173 | 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;
-
 
9
 
8
 
10
import java.io.File;
-
 
11
import java.io.IOException;
9
import java.io.IOException;
12
import java.net.URLEncoder;
10
import java.net.URLEncoder;
13
import java.util.ArrayList;
11
import java.util.ArrayList;
14
import java.util.Arrays;
12
import java.util.Arrays;
15
import java.util.HashMap;
13
import java.util.HashMap;
Line 300... Line 298...
300
    public List<String[]> getCrumbs() {
298
    public List<String[]> getCrumbs() {
301
    	return this.crumbs;
299
    	return this.crumbs;
302
    }
300
    }
303
 
301
 
304
    public Map<String, String> getSnippets(){
302
    public Map<String, String> getSnippets(){
305
    	if(results != null){
303
        if(results != null){
306
    		snippets = new HashMap<String, String>();	
304
            snippets = new HashMap<String, String>();   
307
	    	for(String docId: results){
305
            for(String docId: results){
308
				try {
-
 
309
					snippets.put(docId, FileUtils.read( Utils.EXPORT_ENTITIES_PATH + docId + File.separator +"CategorySnippet.html"));
306
                String snippet = CategorySnippetCacheWrapper.getSnippet(docId);
310
				} catch (IOException e) {
307
                if (snippet != null) {
311
					log.error(e);
308
                    snippets.put(docId, snippet);
312
				}
309
                }
313
			}
310
            }
314
    	}
311
        }
315
		return snippets;
312
        return snippets;
316
    }
313
    }
317
 
314
 
318
}
315
}