Shinsuke Sugaya пре 10 година
родитељ
комит
7203b2d0db

+ 11 - 0
src/main/java/jp/sf/fess/helper/WebFsIndexHelper.java

@@ -24,9 +24,11 @@ import java.util.List;
 import javax.annotation.Resource;
 
 import jp.sf.fess.Constants;
+import jp.sf.fess.db.exentity.BoostDocumentRule;
 import jp.sf.fess.db.exentity.FileCrawlingConfig;
 import jp.sf.fess.db.exentity.WebCrawlingConfig;
 import jp.sf.fess.interval.FessIntervalController;
+import jp.sf.fess.service.BoostDocumentRuleService;
 import jp.sf.fess.service.FailureUrlService;
 import jp.sf.fess.service.FileAuthenticationService;
 import jp.sf.fess.service.FileCrawlingConfigService;
@@ -68,6 +70,9 @@ public class WebFsIndexHelper implements Serializable {
     @Resource
     public FailureUrlService failureUrlService;
 
+    @Resource
+    protected BoostDocumentRuleService boostDocumentRuleService;
+
     @Resource
     protected CrawlingConfigHelper crawlingConfigHelper;
 
@@ -410,6 +415,12 @@ public class WebFsIndexHelper implements Serializable {
         indexUpdater.setDaemon(true);
         indexUpdater.setCommitPerCount(commitPerCount);
         indexUpdater.setS2RobotList(s2RobotList);
+        for (final BoostDocumentRule rule : boostDocumentRuleService
+                .getAvailableBoostDocumentRuleList()) {
+            indexUpdater
+                    .addBoostDocumentRule(new jp.sf.fess.solr.BoostDocumentRule(
+                            rule));
+        }
         indexUpdater.start();
 
         int startedCrawlerNum = 0;

+ 8 - 0
src/main/java/jp/sf/fess/service/BoostDocumentRuleService.java

@@ -17,6 +17,7 @@
 package jp.sf.fess.service;
 
 import java.io.Serializable;
+import java.util.List;
 import java.util.Map;
 
 import jp.sf.fess.crud.service.BsBoostDocumentRuleService;
@@ -68,4 +69,11 @@ public class BoostDocumentRuleService extends BsBoostDocumentRuleService
 
     }
 
+    public List<BoostDocumentRule> getAvailableBoostDocumentRuleList() {
+        final BoostDocumentRuleCB cb = new BoostDocumentRuleCB();
+        cb.query().setDeletedBy_IsNull();
+        cb.query().addOrderBy_SortOrder_Asc();
+        return boostDocumentRuleBhv.selectList(cb);
+    }
+
 }

+ 9 - 0
src/main/java/jp/sf/fess/solr/BoostDocumentRule.java

@@ -30,6 +30,15 @@ public class BoostDocumentRule {
 
     private String matchExpression;
 
+    public BoostDocumentRule() {
+        // nothing
+    }
+
+    public BoostDocumentRule(final jp.sf.fess.db.exentity.BoostDocumentRule rule) {
+        matchExpression = rule.getUrlExpr();
+        boostExpression = rule.getBoostExpr();
+    }
+
     public boolean match(final Map<String, Object> map) {
 
         if (map == null || map.isEmpty() || matchExpression == null) {