Shinsuke Sugaya 11 years ago
parent
commit
f899e6aa65
1 changed files with 13 additions and 0 deletions
  1. 13 0
      src/main/java/jp/sf/fess/action/IndexAction.java

+ 13 - 0
src/main/java/jp/sf/fess/action/IndexAction.java

@@ -45,6 +45,7 @@ import javax.servlet.http.HttpSession;
 import jp.sf.fess.Constants;
 import jp.sf.fess.Constants;
 import jp.sf.fess.InvalidQueryException;
 import jp.sf.fess.InvalidQueryException;
 import jp.sf.fess.ResultOffsetExceededException;
 import jp.sf.fess.ResultOffsetExceededException;
+import jp.sf.fess.UnsupportedSearchException;
 import jp.sf.fess.db.allcommon.CDef;
 import jp.sf.fess.db.allcommon.CDef;
 import jp.sf.fess.db.exentity.ClickLog;
 import jp.sf.fess.db.exentity.ClickLog;
 import jp.sf.fess.db.exentity.SearchLog;
 import jp.sf.fess.db.exentity.SearchLog;
@@ -268,6 +269,7 @@ public class IndexAction {
 
 
     @Execute(validator = false, input = "index.jsp")
     @Execute(validator = false, input = "index.jsp")
     public String index() {
     public String index() {
+        searchAvailable();
 
 
         buildViewParams();
         buildViewParams();
         buildInitParams();
         buildInitParams();
@@ -275,7 +277,18 @@ public class IndexAction {
         return "index.jsp";
         return "index.jsp";
     }
     }
 
 
+    protected void searchAvailable() {
+        final String supportedSearch = crawlerProperties.getProperty(
+                Constants.SUPPORTED_SEARCH_FEATURE_PROPERTY,
+                Constants.SUPPORTED_SEARCH_WEB);
+        if (Constants.SUPPORTED_SEARCH_NONE.equals(supportedSearch)) {
+            throw new UnsupportedSearchException("A search is not supported: "
+                    + RequestUtil.getRequest().getRequestURL());
+        }
+    }
+
     protected String doSearch() {
     protected String doSearch() {
+        searchAvailable();
 
 
         if (StringUtil.isBlank(indexForm.query)) {
         if (StringUtil.isBlank(indexForm.query)) {
             try {
             try {