fix incremental crawling problem
This commit is contained in:
parent
bd51534edf
commit
8501a106d8
4 changed files with 13 additions and 5 deletions
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package org.codelibs.fess;
|
||||
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.codelibs.core.CoreLibConstants;
|
||||
|
@ -355,4 +356,6 @@ public class Constants extends CoreLibConstants {
|
|||
public static final Integer DEFAULT_DAY_FOR_CLEANUP = 3;
|
||||
|
||||
public static final String FESS_CONF_PATH = "fess.conf.path";
|
||||
|
||||
public static final TimeZone TIMEZONE_UTC = TimeZone.getTimeZone("UTC");
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.codelibs.fess.helper.IndexingHelper;
|
|||
import org.codelibs.fess.helper.SambaHelper;
|
||||
import org.codelibs.fess.mylasta.direction.FessConfig;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
import org.codelibs.fess.util.DocumentUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -111,7 +112,7 @@ public class FessCrawlerThread extends CrawlerThread {
|
|||
return true;
|
||||
}
|
||||
|
||||
final Date expires = (Date) document.get(fessConfig.getIndexFieldExpires());
|
||||
final Date expires = DocumentUtil.getValue(document, fessConfig.getIndexFieldExpires(), Date.class);
|
||||
if (expires != null && expires.getTime() < System.currentTimeMillis()) {
|
||||
final Object idValue = document.get(fessConfig.getIndexFieldId());
|
||||
if (idValue != null) {
|
||||
|
@ -120,7 +121,7 @@ public class FessCrawlerThread extends CrawlerThread {
|
|||
return true;
|
||||
}
|
||||
|
||||
final Date lastModified = (Date) document.get(fessConfig.getIndexFieldLastModified());
|
||||
final Date lastModified = DocumentUtil.getValue(document, fessConfig.getIndexFieldLastModified(), Date.class);
|
||||
if (lastModified == null) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -142,14 +142,18 @@ public class FessFunctions {
|
|||
return null;
|
||||
}
|
||||
try {
|
||||
return new SimpleDateFormat(Constants.ISO_DATETIME_FORMAT).parse(value);
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(Constants.ISO_DATETIME_FORMAT);
|
||||
sdf.setTimeZone(Constants.TIMEZONE_UTC);
|
||||
return sdf.parse(value);
|
||||
} catch (final ParseException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String formatDate(final Date date) {
|
||||
return new SimpleDateFormat(Constants.ISO_DATETIME_FORMAT).format(date);
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(Constants.ISO_DATETIME_FORMAT);
|
||||
sdf.setTimeZone(Constants.TIMEZONE_UTC);
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
public static String formatDate(final LocalDateTime date) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<include path="lastaflute_director.xml"/>
|
||||
<include path="fess.xml" />
|
||||
|
||||
<include path="crawler_es.xml" />
|
||||
<include path="crawler.xml" />
|
||||
|
||||
<component name="indexingHelper" class="org.codelibs.fess.helper.IndexingHelper">
|
||||
</component>
|
||||
|
|
Loading…
Add table
Reference in a new issue