This commit is contained in:
Shinsuke Sugaya 2014-10-12 23:10:31 +09:00
parent 01f889c630
commit 7203b2d0db
3 changed files with 28 additions and 0 deletions

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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) {