refactoring

pull/1/head
orbiter 11 years ago
parent 76c53faeb2
commit f6e441dd77

@ -567,12 +567,12 @@ public class HostBrowser {
// get all urls from the index and store them here
for (String id: internalIDs) {
if (id.equals(urlhash)) continue; // no self-references
DigestURL u = fulltext.getURL(ASCII.getBytes(id));
DigestURL u = fulltext.getURL(id);
if (u != null) references_internal_urls.add(u.toNormalform(true));
}
for (String id: externalIDs) {
if (id.equals(urlhash)) continue; // no self-references
DigestURL u = fulltext.getURL(ASCII.getBytes(id));
DigestURL u = fulltext.getURL(id);
if (u != null) references_external_urls.add(u.toNormalform(true));
}
} catch (final IOException e) {

@ -374,7 +374,7 @@ public class IndexControlRWIs_p {
} catch (final SpaceExceededException e ) {
ConcurrentLog.logException(e);
}
url = segment.fulltext().getURL(b);
url = segment.fulltext().getURL(ASCII.String(b));
segment.fulltext().remove(b);
if ( url != null ) {
for ( final String supportedBlacklistType : supportedBlacklistTypes ) {
@ -401,7 +401,7 @@ public class IndexControlRWIs_p {
} catch (final SpaceExceededException e ) {
ConcurrentLog.logException(e);
}
url = segment.fulltext().getURL(b);
url = segment.fulltext().getURL(ASCII.String(b));
segment.fulltext().remove(b);
if ( url != null ) {
for ( final BlacklistType supportedBlacklistType : BlacklistType.values() ) {

@ -183,7 +183,7 @@ public class IndexControlURLs_p {
}
if (post.containsKey("urlhashdelete")) {
final DigestURL url = segment.fulltext().getURL(ASCII.getBytes(urlhash));
final DigestURL url = segment.fulltext().getURL(urlhash);
if (url == null) {
prop.putHTML("result", "No Entry for URL hash " + urlhash + "; nothing deleted.");
} else {

@ -34,7 +34,7 @@ public class add_ymark {
if (post.containsKey("urlHash")) {
final String urlHash = post.get("urlHash",YMarkUtil.EMPTY_STRING);
final DigestURL url = sb.index.fulltext().getURL(urlHash.getBytes());
final DigestURL url = sb.index.fulltext().getURL(urlHash);
final String folders = post.get(YMarkEntry.BOOKMARK.FOLDERS.key(),YMarkEntry.BOOKMARK.FOLDERS.deflt());
final String tags = post.get(YMarkEntry.BOOKMARK.TAGS.key(),YMarkUtil.EMPTY_STRING);
try {

@ -595,7 +595,7 @@ public class yacysearch {
return prop;
}
final String bookmarkHash = post.get("bookmarkref", ""); // urlhash
final DigestURL url = indexSegment.fulltext().getURL(UTF8.getBytes(bookmarkHash));
final DigestURL url = indexSegment.fulltext().getURL(bookmarkHash);
if ( url != null ) {
try {
sb.tables.bookmarks.createBookmark(

@ -31,6 +31,7 @@ import java.net.MalformedURLException;
import java.util.EnumMap;
import net.yacy.cora.date.ISO8601Formatter;
import net.yacy.cora.document.encoding.ASCII;
import net.yacy.cora.document.encoding.UTF8;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.federate.yacy.CacheStrategy;
@ -82,7 +83,7 @@ public class YMarkMetadata {
public YMarkMetadata(final byte[] urlHash, final Segment indexSegment) {
this.document = null;
this.indexSegment = indexSegment;
this.uri = this.indexSegment.fulltext().getURL(urlHash);
this.uri = this.indexSegment.fulltext().getURL(ASCII.String(urlHash));
}
public YMarkMetadata(final Document document) {

@ -1610,7 +1610,7 @@ public final class Switchboard extends serverSwitch {
public DigestURL getURL(final byte[] urlhash) {
if (urlhash == null) return null;
if (urlhash.length == 0) return null;
final DigestURL url = this.index.fulltext().getURL(urlhash);
final DigestURL url = this.index.fulltext().getURL(ASCII.String(urlhash));
if (url != null) return url;
return this.crawlQueues.getURL(urlhash);
}

@ -268,31 +268,16 @@ public final class Fulltext {
getDefaultConnector().commit(softCommit);
if (this.writeWebgraph) getWebgraphConnector().commit(softCommit);
}
/*
public Date getLoadDate(final String urlHash) {
if (urlHash == null) return null;
try {
SolrDocument doc = this.getDefaultConnector().getDocumentById(urlHash, CollectionSchema.load_date_dt.getSolrFieldName());
Object d = doc == null ? null : doc.getFieldValue(CollectionSchema.load_date_dt.getSolrFieldName());
if (d == null) return null;
assert d instanceof Date : "d = " + d.toString();
if (d instanceof Date) return (Date) d;
if (d instanceof Long) return new Date(((Long) d).longValue());
return null;
} catch (final IOException e) {
return null;
}
}
*/
public DigestURL getURL(final byte[] urlHash) {
if (urlHash == null || this.getDefaultConnector() == null) return null;
public DigestURL getURL(final String urlHashS) {
if (urlHashS == null || this.getDefaultConnector() == null) return null;
try {
SolrDocument doc = this.getDefaultConnector().getDocumentById(ASCII.String(urlHash), CollectionSchema.sku.getSolrFieldName());
SolrDocument doc = this.getDefaultConnector().getDocumentById(urlHashS, CollectionSchema.sku.getSolrFieldName());
Object u = doc == null ? null : doc.getFieldValue(CollectionSchema.sku.getSolrFieldName());
if (u == null) return null;
assert u instanceof String : "u = " + u.toString();
if (u instanceof String) return new DigestURL((String) u, urlHash);
if (u instanceof String) return new DigestURL((String) u, ASCII.getBytes(urlHashS));
return null;
} catch (final IOException e) {
return null;

@ -803,7 +803,7 @@ public class Segment {
if (urlhash == null) return 0;
// determine the url string
final DigestURL url = fulltext().getURL(urlhash);
final DigestURL url = fulltext().getURL(ASCII.String(urlhash));
if (url == null) return 0;
try {

Loading…
Cancel
Save