Subversion Repositories SmartDukaan

Rev

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

Rev 3320 Rev 3329
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
-
 
3
import in.shop2020.serving.cache.CategorySnippetCacheWrapper;
3
import in.shop2020.serving.services.SolrSearchService;
4
import in.shop2020.serving.services.SolrSearchService;
4
import in.shop2020.serving.services.SpecialPageConfigurer;
5
import in.shop2020.serving.services.SpecialPageConfigurer;
5
import in.shop2020.serving.utils.FileUtils;
-
 
6
import in.shop2020.serving.utils.Utils;
-
 
7
 
6
 
8
import java.io.File;
-
 
9
import java.io.IOException;
7
import java.io.IOException;
10
import java.net.URLEncoder;
8
import java.net.URLEncoder;
11
import java.util.ArrayList;
9
import java.util.ArrayList;
12
import java.util.Arrays;
10
import java.util.Arrays;
13
import java.util.HashMap;
11
import java.util.HashMap;
Line 177... Line 175...
177
 
175
 
178
	public long getTotalPages() {
176
	public long getTotalPages() {
179
		return 1 + (totalResults-1)/windowSize;
177
		return 1 + (totalResults-1)/windowSize;
180
	}
178
	}
181
 
179
 
182
	public Map<String, String> getSnippets(){
180
    public Map<String, String> getSnippets(){
183
    	if(results != null){
181
        if(results != null){
184
    		snippets = new HashMap<String, String>();	
182
            snippets = new HashMap<String, String>();   
185
	    	for(String docId: results){
183
            for(String docId: results){
186
				try {
-
 
187
					snippets.put(docId, FileUtils.read( Utils.EXPORT_ENTITIES_PATH + docId + File.separator +"CategorySnippet.html"));
184
                String snippet = CategorySnippetCacheWrapper.getSnippet(docId);
188
				} catch (IOException e) {
185
                if (snippet != null) {
189
					log.error(e);
186
                    snippets.put(docId, snippet);
190
				}
187
                }
191
			}
188
            }
192
    	}
189
        }
193
		return snippets;
190
        return snippets;
194
    }
191
    }
195
 
192
 
196
    public long getCurrentPage() {
193
    public long getCurrentPage() {
197
        return this.page;
194
        return this.page;
198
    }
195
    }