|
|
|
@ -499,6 +499,37 @@ public final class plasmaCrawlLURL extends plasmaURL {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void store() {
|
|
|
|
|
// Check if there is a more recent Entry already in the DB
|
|
|
|
|
Entry oldEntry;
|
|
|
|
|
try {
|
|
|
|
|
if (exists(urlHash)) {
|
|
|
|
|
oldEntry = new Entry (urlHash, null);
|
|
|
|
|
} else {
|
|
|
|
|
oldEntry = null;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
oldEntry = null;
|
|
|
|
|
}
|
|
|
|
|
if ((oldEntry != null) && (isOlder(oldEntry))) {
|
|
|
|
|
// the fetched oldEntry is better, so return its properties instead of the new ones
|
|
|
|
|
// this.urlHash = oldEntry.urlHash; // unnecessary, should be the same
|
|
|
|
|
// this.url = oldEntry.url; // unnecessary, should be the same
|
|
|
|
|
this.descr = oldEntry.descr;
|
|
|
|
|
this.moddate = oldEntry.moddate;
|
|
|
|
|
this.loaddate = oldEntry.loaddate;
|
|
|
|
|
this.referrerHash = oldEntry.referrerHash;
|
|
|
|
|
this.copyCount = oldEntry.copyCount;
|
|
|
|
|
this.flags = oldEntry.flags;
|
|
|
|
|
this.quality = oldEntry.quality;
|
|
|
|
|
this.language = oldEntry.language;
|
|
|
|
|
this.doctype = oldEntry.doctype;
|
|
|
|
|
this.size = oldEntry.size;
|
|
|
|
|
this.wordCount = oldEntry.wordCount;
|
|
|
|
|
// this.snippet // not read from db
|
|
|
|
|
// this.word // not read from db
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// stores the values from the object variables into the database
|
|
|
|
|
final String moddatestr = kelondroBase64Order.enhancedCoder.encodeLong(moddate.getTime() / 86400000, urlDateLength);
|
|
|
|
|
final String loaddatestr = kelondroBase64Order.enhancedCoder.encodeLong(loaddate.getTime() / 86400000, urlDateLength);
|
|
|
|
@ -597,6 +628,18 @@ public final class plasmaCrawlLURL extends plasmaURL {
|
|
|
|
|
return word;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isOlder (Entry other) {
|
|
|
|
|
if (other == null) return false;
|
|
|
|
|
if (moddate.before(other.moddate())) return true;
|
|
|
|
|
if (moddate.equals(other.moddate())) {
|
|
|
|
|
if (loaddate.before(other.loaddate())) return true;
|
|
|
|
|
if (loaddate.equals(other.loaddate())) {
|
|
|
|
|
if (quality < other.quality()) return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private StringBuffer corePropList() {
|
|
|
|
|
// generate a parseable string; this is a simple property-list
|
|
|
|
|
final StringBuffer corePropStr = new StringBuffer(300);
|
|
|
|
|