Shinsuke Sugaya 11 tahun lalu
induk
melakukan
cb3e20ddfe

+ 11 - 17
src/main/java/jp/sf/fess/action/IndexAction.java

@@ -195,6 +195,8 @@ public class IndexAction {
 
     protected String pagingQuery = null;
 
+    public boolean searchLogSupport;
+
     public boolean favoriteSupport;
 
     public boolean screenShotSupport;
@@ -274,8 +276,8 @@ public class IndexAction {
         }
 
         updateSearchParams();
-        doSearchInternal();
         buildViewParams();
+        doSearchInternal();
 
         return "search.jsp";
     }
@@ -777,18 +779,7 @@ public class IndexAction {
             }
         }
         if (StringUtil.isBlank(indexForm.num)) {
-            if (viewHelper.isUseSession()) {
-                final HttpSession session = request.getSession(false);
-                if (session != null) {
-                    final Object resultsPerPage = session
-                            .getAttribute(Constants.RESULTS_PER_PAGE);
-                    if (resultsPerPage != null) {
-                        indexForm.num = resultsPerPage.toString();
-                    }
-                }
-            } else {
-                indexForm.num = String.valueOf(getDefaultPageSize());
-            }
+            indexForm.num = String.valueOf(getDefaultPageSize());
         }
         normalizePageNum();
 
@@ -835,8 +826,6 @@ public class IndexAction {
         indexForm.rt = Long.toString(rt);
 
         // favorite
-        favoriteSupport = Constants.TRUE.equals(crawlerProperties.getProperty(
-                Constants.USER_FAVORITE_PROPERTY, Constants.FALSE));
         if (favoriteSupport || screenShotManager != null) {
             indexForm.queryId = userInfoHelper.generateQueryId(query,
                     documentItems);
@@ -848,8 +837,7 @@ public class IndexAction {
         }
 
         // search log
-        if (Constants.TRUE.equals(crawlerProperties.getProperty(
-                Constants.SEARCH_LOG_PROPERTY, Constants.TRUE))) {
+        if (searchLogSupport) {
             final Timestamp now = new Timestamp(rt);
 
             final SearchLogHelper searchLogHelper = SingletonS2Container
@@ -1059,6 +1047,12 @@ public class IndexAction {
                 }
             }
         }
+
+        searchLogSupport = Constants.TRUE.equals(crawlerProperties.getProperty(
+                Constants.SEARCH_LOG_PROPERTY, Constants.TRUE));
+        favoriteSupport = Constants.TRUE.equals(crawlerProperties.getProperty(
+                Constants.USER_FAVORITE_PROPERTY, Constants.FALSE));
+
     }
 
     protected void buildInitParams() {

+ 1 - 1
src/main/java/jp/sf/fess/service/SearchService.java

@@ -259,7 +259,7 @@ public class SearchService implements Serializable {
 
             if (docValuesFields != null) {
                 for (final String docValuesField : docValuesFields) {
-                    solrQuery.setParam(Constants.DCF, docValuesField);
+                    solrQuery.add(Constants.DCF, docValuesField);
                 }
             }
 

+ 7 - 2
src/main/resources/application.properties

@@ -346,11 +346,16 @@ labels.search_result_sort_contentLength_asc=Size (ascending)
 labels.search_result_sort_contentLength_desc=Size (descending)
 labels.search_result_sort_lastModified_asc=Last Modified (ascending)
 labels.search_result_sort_lastModified_desc=Last Modified (descending)
+labels.search_result_sort_clickCount_asc=Click (ascending)
+labels.search_result_sort_clickCount_desc=Click (descending)
+labels.search_result_sort_favoriteCount_asc=Favorite (ascending)
+labels.search_result_sort_favoriteCount_desc=Favorite (descending)
 labels.search_result_size={0} bytes
 labels.search_result_created=Registered: 
 labels.search_result_lastModified=Last Modified: 
-labels.search_result_favorite=Vote it
-labels.search_result_favorited=Voted
+labels.search_result_favorite=Vote it ({0})
+labels.search_result_favorited=Voted ({0})
+labels.search_click_count=Click ({0})
 labels.search_result_more=more..
 
 label.facet_label_title=Label

+ 7 - 2
src/main/resources/application_ja.properties

@@ -346,11 +346,16 @@ labels.search_result_sort_contentLength_asc=\u30b5\u30a4\u30ba (\u6607\u9806)
 labels.search_result_sort_contentLength_desc=\u30b5\u30a4\u30ba (\u964d\u9806)
 labels.search_result_sort_lastModified_asc=\u66f4\u65b0\u65e5\u6642 (\u6607\u9806)
 labels.search_result_sort_lastModified_desc=\u66f4\u65b0\u65e5\u6642 (\u964d\u9806)
+labels.search_result_sort_clickCount_asc=\u30af\u30ea\u30c3\u30af\u6570 (\u6607\u9806)
+labels.search_result_sort_clickCount_desc=\u30af\u30ea\u30c3\u30af\u6570 (\u964d\u9806)
+labels.search_result_sort_favoriteCount_asc=\u304a\u6c17\u306b\u5165\u308a\u6570 (\u6607\u9806)
+labels.search_result_sort_favoriteCount_desc=\u304a\u6c17\u306b\u5165\u308a\u6570 (\u964d\u9806)
 labels.search_result_size={0} \u30d0\u30a4\u30c8
 labels.search_result_created=\u767b\u9332\u65e5\u6642: 
 labels.search_result_lastModified=\u66f4\u65b0\u65e5\u6642: 
-labels.search_result_favorite=1\u7968\u5165\u308c\u308b
-labels.search_result_favorited=\u6295\u7968\u6e08\u307f
+labels.search_result_favorite=1\u7968\u5165\u308c\u308b ({0})
+labels.search_result_favorited=\u6295\u7968\u6e08\u307f ({0})
+labels.search_click_count=\u30af\u30ea\u30c3\u30af\u6570 ({0})
 labels.search_result_more=\u8a73\u7d30..
 
 label.facet_label_title=\u30e9\u30d9\u30eb

+ 17 - 0
src/main/webapp/WEB-INF/view/header.jsp

@@ -81,6 +81,23 @@ ${fe:facetForm()}${fe:mltForm()}${fe:geoForm()}
 							<html:option value="lastModified.desc">
 								<bean:message key="labels.search_result_sort_lastModified_desc" />
 							</html:option>
+							<c:if test="${searchLogSupport}">
+							<html:option value="clickCount_l_x_dv.asc">
+								<bean:message key="labels.search_result_sort_clickCount_asc" />
+							</html:option>
+							<html:option value="clickCount_l_x_dv.desc">
+								<bean:message key="labels.search_result_sort_clickCount_desc" />
+							</html:option>
+							</c:if>
+							<c:if test="${favoriteSupport}">
+							<html:option value="favoriteCount_l_x_dv.asc">
+								<bean:message key="labels.search_result_sort_favoriteCount_asc" />
+							</html:option>
+							<html:option value="favoriteCount_l_x_dv.desc">
+								<bean:message
+									key="labels.search_result_sort_favoriteCount_desc" />
+							</html:option>
+							</c:if>
 						</html:select>
 					</div>
 				</div>

+ 19 - 0
src/main/webapp/WEB-INF/view/index.jsp

@@ -137,6 +137,25 @@
 												<bean:message
 													key="labels.search_result_sort_lastModified_desc" />
 											</html:option>
+											<c:if test="${searchLogSupport}">
+											<html:option value="clickCount_l_x_dv.asc">
+												<bean:message
+													key="labels.search_result_sort_clickCount_asc" />
+											</html:option>
+											<html:option value="clickCount_l_x_dv.desc">
+												<bean:message
+													key="labels.search_result_sort_clickCount_desc" />
+											</html:option>
+											</c:if><c:if test="${favoriteSupport}">
+											<html:option value="favoriteCount_l_x_dv.asc">
+												<bean:message
+													key="labels.search_result_sort_favoriteCount_asc" />
+											</html:option>
+											<html:option value="favoriteCount_l_x_dv.desc">
+												<bean:message
+													key="labels.search_result_sort_favoriteCount_desc" />
+											</html:option>
+											</c:if>
 										</html:select>
 									</div>
 								</div>

+ 13 - 9
src/main/webapp/WEB-INF/view/searchResults.jsp

@@ -41,29 +41,33 @@
 						</div>
 						<div class="info">
 							<c:if test="${doc.created!=null && doc.created!=''}">
+								<c:set var="hasInfo" value="true"/>
 								<bean:message key="labels.search_result_created" />
 								<fmt:formatDate value="${fe:parseDate(doc.created)}" type="BOTH" />
-								<span class="br-phone"></span>
-								<span class="hidden-phone">-</span>
 							</c:if>
 							<c:if test="${doc.lastModified!=null && doc.lastModified!=''}">
+								<c:if test="${hasInfo}"><span class="br-phone"></span><span class="hidden-phone">-</span></c:if><c:set var="hasInfo" value="true"/>
 								<bean:message key="labels.search_result_lastModified" />
 								<fmt:formatDate value="${fe:parseDate(doc.lastModified)}" type="BOTH" />
-								<span class="br-phone"></span>
-								<span class="br-tablet"></span>
-								<span class="hidden-phone hidden-tablet">-</span>
 							</c:if>
 							<c:if test="${doc.contentLength!=null && doc.contentLength!=''}">
+								<c:if test="${hasInfo}"><span class="br-phone"></span><span class="hidden-phone">-</span></c:if><c:set var="hasInfo" value="true"/>
 								<bean:message key="labels.search_result_size"
 									arg0="${f:h(doc.contentLength)}" />
-								<span class="br-phone"></span>
-								<span class="hidden-phone">-</span>
+							</c:if>
+							<c:if test="${searchLogSupport}">
+								<c:if test="${hasInfo}"><span class="br-phone"></span><span class="hidden-phone">-</span></c:if><c:set var="hasInfo" value="true"/>
+								<bean:message key="labels.search_click_count"
+									arg0="${f:h(doc.clickCount_l_x_dv)}" />
 							</c:if>
 							<c:if test="${favoriteSupport}">
+								<c:if test="${hasInfo}"><span class="br-phone"></span><span class="hidden-phone">-</span></c:if><c:set var="hasInfo" value="true"/>
 								<a href="#${doc.docId}" class="favorite"><bean:message
-										key="labels.search_result_favorite" /></a>
+										key="labels.search_result_favorite"
+										arg0="${f:h(doc.favoriteCount_l_x_dv)}" /></a>
 								<span class="favorited"><bean:message
-										key="labels.search_result_favorited" /></span>
+										key="labels.search_result_favorited"
+										arg0="${f:h(doc.favoriteCount_l_x_dv)}" /></span>
 							</c:if>
 						</div>
 					</div>