Showing
2 changed files
with
26 additions
and
24 deletions
@@ -63,29 +63,7 @@ public class SearchCommonService implements ApplicationEventPublisherAware { | @@ -63,29 +63,7 @@ public class SearchCommonService implements ApplicationEventPublisherAware { | ||
63 | 63 | ||
64 | /** | 64 | /** |
65 | * 通用的查询接口 | 65 | * 通用的查询接口 |
66 | - * | ||
67 | - * @param indexName | ||
68 | - * @param searchParam | ||
69 | - * @return | ||
70 | - */ | ||
71 | - public SearchResult doSearch(final String indexName, final SearchParam searchParam) { | ||
72 | - long begin = System.currentTimeMillis(); | ||
73 | - performanceMonitor.addVisitCount(); | ||
74 | - try { | ||
75 | - IElasticsearchClient client = elasticsearchClientFactory.getClient(indexName); | ||
76 | - SearchResult searchResult = client.search(indexName, indexName, searchParam); | ||
77 | - this.publishSearchResultEvent(indexName, searchParam, searchResult); | ||
78 | - return searchResult; | ||
79 | - } catch (Exception e) { | ||
80 | - throw e; | ||
81 | - }finally{ | ||
82 | - performanceMonitor.addCost(System.currentTimeMillis() - begin); | ||
83 | - } | ||
84 | - } | ||
85 | - | ||
86 | - /** | ||
87 | - * 通用的查询接口 | ||
88 | - * | 66 | + * |
89 | * @param indexName | 67 | * @param indexName |
90 | * @param | 68 | * @param |
91 | * @return | 69 | * @return |
@@ -141,6 +119,28 @@ public class SearchCommonService implements ApplicationEventPublisherAware { | @@ -141,6 +119,28 @@ public class SearchCommonService implements ApplicationEventPublisherAware { | ||
141 | } | 119 | } |
142 | 120 | ||
143 | /** | 121 | /** |
122 | + * 通用的查询接口 | ||
123 | + * | ||
124 | + * @param indexName | ||
125 | + * @param searchParam | ||
126 | + * @return | ||
127 | + */ | ||
128 | + public SearchResult doSearch(final String indexName, final SearchParam searchParam) { | ||
129 | + long begin = System.currentTimeMillis(); | ||
130 | + performanceMonitor.addVisitCount(); | ||
131 | + try { | ||
132 | + IElasticsearchClient client = elasticsearchClientFactory.getClient(indexName); | ||
133 | + SearchResult searchResult = client.search(indexName, indexName, searchParam); | ||
134 | + this.publishSearchResultEvent(indexName, searchParam, searchResult); | ||
135 | + return searchResult; | ||
136 | + } catch (Exception e) { | ||
137 | + throw e; | ||
138 | + }finally{ | ||
139 | + performanceMonitor.addCost(System.currentTimeMillis() - begin); | ||
140 | + } | ||
141 | + } | ||
142 | + | ||
143 | + /** | ||
144 | * 通过id获取内容 | 144 | * 通过id获取内容 |
145 | * | 145 | * |
146 | * @param indexName | 146 | * @param indexName |
@@ -236,7 +236,9 @@ public class CsSearchResourceService { | @@ -236,7 +236,9 @@ public class CsSearchResourceService { | ||
236 | String default_images = MapUtils.getString(product, "default_images", ""); | 236 | String default_images = MapUtils.getString(product, "default_images", ""); |
237 | default_images = getDefaultImages(cover_1, cover_2, default_images, productGender); | 237 | default_images = getDefaultImages(cover_1, cover_2, default_images, productGender); |
238 | default_images = ImageUrlAssist.getAllProductPicUrl(default_images, "goodsimg", "center", "d2hpdGU="); | 238 | default_images = ImageUrlAssist.getAllProductPicUrl(default_images, "goodsimg", "center", "d2hpdGU="); |
239 | - resource.put("bgImage", resource.get("image")); | 239 | + if(null==resource.get("bgImage")){ // 缓存中可能已经有了 |
240 | + resource.put("bgImage", resource.get("image")); | ||
241 | + } | ||
240 | resource.replace("image", default_images); | 242 | resource.replace("image", default_images); |
241 | resource.put("firstProductSkn", productSkn); | 243 | resource.put("firstProductSkn", productSkn); |
242 | resource.put("bgName", "主题精选"); | 244 | resource.put("bgName", "主题精选"); |
-
Please register or login to post a comment