Skip to content

Commit

Permalink
fix #28
Browse files Browse the repository at this point in the history
  • Loading branch information
marevol committed Nov 8, 2013
1 parent 3b10e17 commit 4133ab1
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion src/main/java/jp/sf/fess/robot/FessS2RobotThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
import jcifs.smb.ACE;
import jcifs.smb.SID;
import jp.sf.fess.Constants;
import jp.sf.fess.db.cbean.ClickLogCB;
import jp.sf.fess.db.cbean.FavoriteLogCB;
import jp.sf.fess.db.exbhv.ClickLogBhv;
import jp.sf.fess.db.exbhv.FavoriteLogBhv;
import jp.sf.fess.db.exentity.CrawlingConfig;
import jp.sf.fess.helper.CrawlingConfigHelper;
import jp.sf.fess.helper.CrawlingSessionHelper;
Expand Down Expand Up @@ -61,6 +65,10 @@ public class FessS2RobotThread extends S2RobotThread {

public int childUrlSize = 10000;

public String clickCountField = "clickCount_i";

public String favoriteCountField = "favoriteCount_i";

@Override
protected boolean isContentUpdated(final S2RobotClient client,
final UrlQueue urlQueue) {
Expand Down Expand Up @@ -157,6 +165,34 @@ protected boolean isContentUpdated(final S2RobotClient client,
return true;
}

final Integer clickCount = (Integer) solrDocument
.get(clickCountField);
if (clickCount != null) {
final ClickLogBhv clickLogBhv = SingletonS2Container
.getComponent(ClickLogBhv.class);
final ClickLogCB cb = new ClickLogCB();
cb.query().setUrl_Equal(urlQueue.getUrl());
final int count = clickLogBhv.selectCount(cb);
if (count != clickCount.intValue()) {
deleteSolrDocumentList(oldDocWithRoleList);
return true;
}
}

final Integer favoriteCount = (Integer) solrDocument
.get(favoriteCountField);
if (favoriteCount != null) {
final FavoriteLogBhv favoriteLogBhv = SingletonS2Container
.getComponent(FavoriteLogBhv.class);
final FavoriteLogCB cb = new FavoriteLogCB();
cb.query().setUrl_Equal(urlQueue.getUrl());
final int count = favoriteLogBhv.selectCount(cb);
if (count != favoriteCount.intValue()) {
deleteSolrDocumentList(oldDocWithRoleList);
return true;
}
}

final int httpStatusCode = responseData.getHttpStatusCode();
if (httpStatusCode == 404) {
deleteSolrDocument(id);
Expand Down Expand Up @@ -245,7 +281,7 @@ protected SolrDocumentList getSolrDocumentList(final String id,
queryBuf.append(id);
solrQuery.setQuery(queryBuf.toString());
solrQuery.setFields("id", "lastModified", "anchor", "segment", "role",
expiresField);
expiresField, clickCountField, favoriteCountField);
for (int i = 0; i < maxSolrQueryRetryCount; i++) {
try {
final QueryResponse response = solrGroup.query(solrQuery);
Expand Down

0 comments on commit 4133ab1

Please sign in to comment.