From 18f989dfb189f9e80eea507af5eb32931d2ad47a Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Fri, 17 Aug 2012 01:34:38 +0200 Subject: [PATCH] - refactoring (load -> getMetadata) - added getDocument to retrieve Solr documents which shall replace getMetadata --- htroot/Bookmarks.java | 2 +- htroot/CrawlResults.java | 2 +- htroot/IndexControlRWIs_p.java | 6 +-- htroot/IndexControlURLs_p.java | 8 +-- htroot/ViewFile.java | 2 +- htroot/Vocabulary_p.java | 4 +- htroot/api/yacydoc.java | 4 +- htroot/api/ymarks/add_ymark.java | 2 +- htroot/yacy/crawlReceipt.java | 2 +- htroot/yacy/transferURL.java | 2 +- htroot/yacy/urls.java | 2 +- htroot/yacysearch.java | 4 +- source/de/anomic/crawler/CrawlStacker.java | 2 +- source/de/anomic/crawler/SitemapImporter.java | 2 +- .../de/anomic/data/ymark/YMarkMetadata.java | 4 +- source/net/yacy/peers/Protocol.java | 2 +- source/net/yacy/peers/dht/Transmission.java | 2 +- source/net/yacy/search/Switchboard.java | 2 +- .../yacy/search/index/MetadataRepository.java | 51 +++++++++++++++---- source/net/yacy/search/index/Segment.java | 6 +-- source/net/yacy/search/query/RWIProcess.java | 4 +- 21 files changed, 74 insertions(+), 41 deletions(-) diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.java index 2d6a2273c..2aa85a467 100644 --- a/htroot/Bookmarks.java +++ b/htroot/Bookmarks.java @@ -195,7 +195,7 @@ public class Bookmarks { final BookmarksDB.Bookmark bookmark = sb.bookmarksDB.getBookmark(urlHash); if (bookmark == null) { // try to get the bookmark from the LURL database - final URIMetadata urlentry = sb.index.urlMetadata().load(ASCII.getBytes(urlHash)); + final URIMetadata urlentry = sb.index.urlMetadata().getMetadata(ASCII.getBytes(urlHash)); if (urlentry != null) try { final Document document = Document.mergeDocuments(urlentry.url(), null, sb.loader.loadDocuments(sb.loader.request(urlentry.url(), true, false), CacheStrategy.IFEXIST, Integer.MAX_VALUE, null, TextSnippet.snippetMinLoadDelay)); prop.put("mode_edit", "0"); // create mode diff --git a/htroot/CrawlResults.java b/htroot/CrawlResults.java index 0dae87a22..4e539e298 100644 --- a/htroot/CrawlResults.java +++ b/htroot/CrawlResults.java @@ -186,7 +186,7 @@ public class CrawlResults { while (i.hasNext()) { entry = i.next(); try { - urle = sb.index.urlMetadata().load(UTF8.getBytes(entry.getKey())); + urle = sb.index.urlMetadata().getMetadata(UTF8.getBytes(entry.getKey())); if (urle == null) { Log.logWarning("PLASMA", "CrawlResults: URL not in index with url hash " + entry.getKey()); urlstr = null; diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.java index 4e82edae0..3db8df815 100644 --- a/htroot/IndexControlRWIs_p.java +++ b/htroot/IndexControlRWIs_p.java @@ -320,7 +320,7 @@ public class IndexControlRWIs_p { URIMetadata lurl; while (urlIter.hasNext()) { iEntry = urlIter.next(); - lurl = segment.urlMetadata().load(iEntry.urlhash()); + lurl = segment.urlMetadata().getMetadata(iEntry.urlhash()); if (lurl == null) { try { unknownURLEntries.put(iEntry.urlhash()); @@ -415,7 +415,7 @@ public class IndexControlRWIs_p { } catch ( final SpaceExceededException e ) { Log.logException(e); } - final URIMetadata e = segment.urlMetadata().load(b); + final URIMetadata e = segment.urlMetadata().getMetadata(b); segment.urlMetadata().remove(b); if ( e != null ) { url = e.url(); @@ -450,7 +450,7 @@ public class IndexControlRWIs_p { } catch ( final SpaceExceededException e ) { Log.logException(e); } - final URIMetadata e = segment.urlMetadata().load(b); + final URIMetadata e = segment.urlMetadata().getMetadata(b); segment.urlMetadata().remove(b); if ( e != null ) { url = e.url(); diff --git a/htroot/IndexControlURLs_p.java b/htroot/IndexControlURLs_p.java index 820c8b4f6..506d32f70 100644 --- a/htroot/IndexControlURLs_p.java +++ b/htroot/IndexControlURLs_p.java @@ -132,7 +132,7 @@ public class IndexControlURLs_p { } if (post.containsKey("urlhashdelete")) { - final URIMetadata entry = segment.urlMetadata().load(ASCII.getBytes(urlhash)); + final URIMetadata entry = segment.urlMetadata().getMetadata(ASCII.getBytes(urlhash)); if (entry == null) { prop.putHTML("result", "No Entry for URL hash " + urlhash + "; nothing deleted."); } else { @@ -166,7 +166,7 @@ public class IndexControlURLs_p { final DigestURI url = new DigestURI(urlstring); urlhash = ASCII.String(url.hash()); prop.put("urlhash", urlhash); - final URIMetadata entry = segment.urlMetadata().load(ASCII.getBytes(urlhash)); + final URIMetadata entry = segment.urlMetadata().getMetadata(ASCII.getBytes(urlhash)); if (entry == null) { prop.putHTML("result", "No Entry for URL " + url.toNormalform(true, true)); prop.putHTML("urlstring", urlstring); @@ -184,7 +184,7 @@ public class IndexControlURLs_p { } if (post.containsKey("urlhashsearch")) { - final URIMetadata entry = segment.urlMetadata().load(ASCII.getBytes(urlhash)); + final URIMetadata entry = segment.urlMetadata().getMetadata(ASCII.getBytes(urlhash)); if (entry == null) { prop.putHTML("result", "No Entry for URL hash " + urlhash); } else { @@ -310,7 +310,7 @@ public class IndexControlURLs_p { prop.put("genUrlProfile_urlhash", urlhash); return prop; } - final URIMetadata le = (entry.referrerHash() == null || entry.referrerHash().length != Word.commonHashLength) ? null : segment.urlMetadata().load(entry.referrerHash()); + final URIMetadata le = (entry.referrerHash() == null || entry.referrerHash().length != Word.commonHashLength) ? null : segment.urlMetadata().getMetadata(entry.referrerHash()); if (entry.url() == null) { prop.put("genUrlProfile", "1"); prop.put("genUrlProfile_urlhash", urlhash); diff --git a/htroot/ViewFile.java b/htroot/ViewFile.java index 07d45deb3..0bf288e3b 100644 --- a/htroot/ViewFile.java +++ b/htroot/ViewFile.java @@ -138,7 +138,7 @@ public class ViewFile { // get the urlEntry that belongs to the url hash //boolean ue = urlHash.length() > 0 && indexSegment.exists(ASCII.getBytes(urlHash)); //if (ue) Log.logInfo("ViewFile", "exists(" + urlHash + ")"); - if (urlHash.length() > 0 && (urlEntry = indexSegment.urlMetadata().load(ASCII.getBytes(urlHash))) != null) { + if (urlHash.length() > 0 && (urlEntry = indexSegment.urlMetadata().getMetadata(ASCII.getBytes(urlHash))) != null) { // get the url that belongs to the entry if (urlEntry == null || urlEntry.url() == null) { prop.put("error", "3"); diff --git a/htroot/Vocabulary_p.java b/htroot/Vocabulary_p.java index 8f10f903a..7a604d342 100644 --- a/htroot/Vocabulary_p.java +++ b/htroot/Vocabulary_p.java @@ -86,12 +86,12 @@ public class Vocabulary_p { if (p >= 0) t = t.substring(p + 1); } if (discoverFromTitle || discoverFromTitleSplitted) { - URIMetadata m = segment.urlMetadata().load(u.hash()); + URIMetadata m = segment.urlMetadata().getMetadata(u.hash()); if (m != null) t = m.dc_title(); if (t.endsWith(".jpg") || t.endsWith(".gif")) continue; } if (discoverFromAuthor) { - URIMetadata m = segment.urlMetadata().load(u.hash()); + URIMetadata m = segment.urlMetadata().getMetadata(u.hash()); if (m != null) t = m.dc_creator(); } t = t.replaceAll("_", " ").replaceAll("\"", " ").replaceAll("'", " ").replaceAll(",", " ").replaceAll(" ", " ").trim(); diff --git a/htroot/api/yacydoc.java b/htroot/api/yacydoc.java index 1e26c55b3..62ce2735a 100644 --- a/htroot/api/yacydoc.java +++ b/htroot/api/yacydoc.java @@ -97,13 +97,13 @@ public class yacydoc { } if (urlhash == null || urlhash.isEmpty()) return prop; - final URIMetadata entry = segment.urlMetadata().load(urlhash.getBytes()); + final URIMetadata entry = segment.urlMetadata().getMetadata(urlhash.getBytes()); if (entry == null) return prop; if (entry.url() == null) { return prop; } - final URIMetadata le = (entry.referrerHash() == null || entry.referrerHash().length != Word.commonHashLength) ? null : segment.urlMetadata().load(entry.referrerHash()); + final URIMetadata le = (entry.referrerHash() == null || entry.referrerHash().length != Word.commonHashLength) ? null : segment.urlMetadata().getMetadata(entry.referrerHash()); prop.putXML("dc_title", entry.dc_title()); prop.putXML("dc_creator", entry.dc_creator()); diff --git a/htroot/api/ymarks/add_ymark.java b/htroot/api/ymarks/add_ymark.java index 795423f56..fd2a9a9c6 100644 --- a/htroot/api/ymarks/add_ymark.java +++ b/htroot/api/ymarks/add_ymark.java @@ -34,7 +34,7 @@ public class add_ymark { if(post.containsKey("urlHash")) { final String urlHash = post.get("urlHash",YMarkUtil.EMPTY_STRING); - final DigestURI url = sb.index.urlMetadata().load(urlHash.getBytes()).url(); + final DigestURI url = sb.index.urlMetadata().getMetadata(urlHash.getBytes()).url(); 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 { diff --git a/htroot/yacy/crawlReceipt.java b/htroot/yacy/crawlReceipt.java index 5ab0bedfe..56b11f833 100644 --- a/htroot/yacy/crawlReceipt.java +++ b/htroot/yacy/crawlReceipt.java @@ -147,7 +147,7 @@ public final class crawlReceipt { if ("fill".equals(result)) try { // put new entry into database - sb.index.urlMetadata().store(entry); + sb.index.urlMetadata().putMetadata(entry); ResultURLs.stack(entry, youare.getBytes(), iam.getBytes(), EventOrigin.REMOTE_RECEIPTS); sb.crawlQueues.delegatedURL.remove(entry.hash()); // the delegated work has been done if (log.isInfo()) log.logInfo("crawlReceipt: RECEIVED RECEIPT from " + otherPeerName + " for URL " + ASCII.String(entry.hash()) + ":" + entry.url().toNormalform(false, true)); diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.java index ca1a27c0b..64114b657 100644 --- a/htroot/yacy/transferURL.java +++ b/htroot/yacy/transferURL.java @@ -141,7 +141,7 @@ public final class transferURL { // write entry to database if (Network.log.isFine()) Network.log.logFine("Accepting URL " + i + "/" + urlc + " from peer " + otherPeerName + ": " + lEntry.url().toNormalform(true, false)); try { - sb.index.urlMetadata().store(lEntry); + sb.index.urlMetadata().putMetadata(lEntry); ResultURLs.stack(lEntry, iam.getBytes(), iam.getBytes(), EventOrigin.DHT_TRANSFER); if (Network.log.isFine()) Network.log.logFine("transferURL: received URL '" + lEntry.url().toNormalform(false, true) + "' from peer " + otherPeerName); received++; diff --git a/htroot/yacy/urls.java b/htroot/yacy/urls.java index 58e8acc93..083aeb74e 100644 --- a/htroot/yacy/urls.java +++ b/htroot/yacy/urls.java @@ -113,7 +113,7 @@ public class urls { URIMetadata entry; DigestURI referrer; for (int i = 0; i < count; i++) { - entry = sb.index.urlMetadata().load(ASCII.getBytes(urlhashes.substring(12 * i, 12 * (i + 1)))); + entry = sb.index.urlMetadata().getMetadata(ASCII.getBytes(urlhashes.substring(12 * i, 12 * (i + 1)))); if (entry == null) continue; // find referrer, if there is one referrer = sb.getURL(entry.referrerHash()); diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index 7431676bf..237e8337e 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -660,7 +660,7 @@ public class yacysearch { return prop; } final String recommendHash = post.get("recommendref", ""); // urlhash - final URIMetadata urlentry = indexSegment.urlMetadata().load(UTF8.getBytes(recommendHash)); + final URIMetadata urlentry = indexSegment.urlMetadata().getMetadata(UTF8.getBytes(recommendHash)); if ( urlentry != null ) { Document[] documents = null; try { @@ -696,7 +696,7 @@ public class yacysearch { return prop; } final String bookmarkHash = post.get("bookmarkref", ""); // urlhash - final URIMetadata urlentry = indexSegment.urlMetadata().load(UTF8.getBytes(bookmarkHash)); + final URIMetadata urlentry = indexSegment.urlMetadata().getMetadata(UTF8.getBytes(bookmarkHash)); if ( urlentry != null ) { try { sb.tables.bookmarks.createBookmark( diff --git a/source/de/anomic/crawler/CrawlStacker.java b/source/de/anomic/crawler/CrawlStacker.java index 276f20052..d5afa0951 100644 --- a/source/de/anomic/crawler/CrawlStacker.java +++ b/source/de/anomic/crawler/CrawlStacker.java @@ -437,7 +437,7 @@ public final class CrawlStacker { // check if the url is double registered final String dbocc = this.nextQueue.urlExists(url.hash()); // returns the name of the queue if entry exists - final URIMetadata oldEntry = this.indexSegment.urlMetadata().load(url.hash()); + final URIMetadata oldEntry = this.indexSegment.urlMetadata().getMetadata(url.hash()); if (oldEntry == null) { if (dbocc != null) { // do double-check diff --git a/source/de/anomic/crawler/SitemapImporter.java b/source/de/anomic/crawler/SitemapImporter.java index 22189886d..0b46473ab 100644 --- a/source/de/anomic/crawler/SitemapImporter.java +++ b/source/de/anomic/crawler/SitemapImporter.java @@ -84,7 +84,7 @@ public class SitemapImporter extends Thread { final String dbocc = this.sb.urlExists(nexturlhash); if ((dbocc != null) && (dbocc.equalsIgnoreCase("loaded"))) { // the url was already loaded. we need to check the date - final URIMetadata oldEntry = this.sb.index.urlMetadata().load(nexturlhash); + final URIMetadata oldEntry = this.sb.index.urlMetadata().getMetadata(nexturlhash); if (oldEntry != null) { final Date modDate = oldEntry.moddate(); // check if modDate is null diff --git a/source/de/anomic/data/ymark/YMarkMetadata.java b/source/de/anomic/data/ymark/YMarkMetadata.java index 4e4ad09c7..2e25f80c1 100644 --- a/source/de/anomic/data/ymark/YMarkMetadata.java +++ b/source/de/anomic/data/ymark/YMarkMetadata.java @@ -82,7 +82,7 @@ public class YMarkMetadata { public YMarkMetadata(final byte[] urlHash, final Segment indexSegment) { this.document = null; this.indexSegment = indexSegment; - this.uri = this.indexSegment.urlMetadata().load(urlHash).url(); + this.uri = this.indexSegment.urlMetadata().getMetadata(urlHash).url(); } public YMarkMetadata(final Document document) { @@ -106,7 +106,7 @@ public class YMarkMetadata { public EnumMap getMetadata() { final EnumMap metadata = new EnumMap(METADATA.class); - final URIMetadata urlEntry = this.indexSegment.urlMetadata().load(this.uri.hash()); + final URIMetadata urlEntry = this.indexSegment.urlMetadata().getMetadata(this.uri.hash()); if (urlEntry != null) { metadata.put(METADATA.SIZE, String.valueOf(urlEntry.size())); metadata.put(METADATA.FRESHDATE, ISO8601Formatter.FORMATTER.format(urlEntry.freshdate())); diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java index 1e561a9f5..a43fdfd1e 100644 --- a/source/net/yacy/peers/Protocol.java +++ b/source/net/yacy/peers/Protocol.java @@ -754,7 +754,7 @@ public final class Protocol // passed all checks, store url try { - indexSegment.urlMetadata().store(urlEntry); + indexSegment.urlMetadata().putMetadata(urlEntry); ResultURLs.stack( urlEntry, mySeed.hash.getBytes(), diff --git a/source/net/yacy/peers/dht/Transmission.java b/source/net/yacy/peers/dht/Transmission.java index e5a890cdd..28bd1df3f 100644 --- a/source/net/yacy/peers/dht/Transmission.java +++ b/source/net/yacy/peers/dht/Transmission.java @@ -176,7 +176,7 @@ public class Transmission { notFoundx.add(e.urlhash()); continue; } - final URIMetadata r = Transmission.this.segment.urlMetadata().load(e.urlhash()); + final URIMetadata r = Transmission.this.segment.urlMetadata().getMetadata(e.urlhash()); if (r == null) { notFoundx.add(e.urlhash()); this.badReferences.put(e.urlhash()); diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java index 615926453..6e8ed4e54 100644 --- a/source/net/yacy/search/Switchboard.java +++ b/source/net/yacy/search/Switchboard.java @@ -1455,7 +1455,7 @@ public final class Switchboard extends serverSwitch if ( urlhash.length == 0 ) { return null; } - final URIMetadata le = this.index.urlMetadata().load(urlhash); + final URIMetadata le = this.index.urlMetadata().getMetadata(urlhash); if ( le != null ) { return le.url(); } diff --git a/source/net/yacy/search/index/MetadataRepository.java b/source/net/yacy/search/index/MetadataRepository.java index 5521a661d..4a7be73b9 100644 --- a/source/net/yacy/search/index/MetadataRepository.java +++ b/source/net/yacy/search/index/MetadataRepository.java @@ -62,6 +62,7 @@ import net.yacy.search.Switchboard; import net.yacy.search.solr.EmbeddedSolrConnector; import org.apache.lucene.util.Version; +import org.apache.solr.client.solrj.util.ClientUtils; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrException; @@ -197,17 +198,17 @@ public final class MetadataRepository implements Iterable { * @param obrwi * @return */ - public URIMetadata load(WordReference wre, long weight) { + public URIMetadata getMetadata(WordReference wre, long weight) { if (wre == null) return null; // all time was already wasted in takeRWI to get another element - return load(wre.urlhash(), wre, weight); + return getMetadata(wre.urlhash(), wre, weight); } - public URIMetadata load(final byte[] urlHash) { + public URIMetadata getMetadata(final byte[] urlHash) { if (urlHash == null) return null; - return load(urlHash, null, 0); + return getMetadata(urlHash, null, 0); } - private URIMetadata load(final byte[] urlHash, WordReference wre, long weight) { + private URIMetadata getMetadata(final byte[] urlHash, WordReference wre, long weight) { // get the metadata from Solr try { @@ -228,7 +229,39 @@ public final class MetadataRepository implements Iterable { return null; } - public void store(final URIMetadata entry) throws IOException { + public SolrDocument getDocument(WordReference wre, long weight) { + if (wre == null) return null; // all time was already wasted in takeRWI to get another element + return getDocument(wre.urlhash(), wre, weight); + } + + public SolrDocument getDocument(final byte[] urlHash) { + if (urlHash == null) return null; + return getDocument(urlHash, null, 0); + } + + private SolrDocument getDocument(final byte[] urlHash, WordReference wre, long weight) { + + // get the document from Solr + try { + SolrDocument doc = this.solr.get(ASCII.String(urlHash)); + if (doc != null) return doc; + } catch (IOException e) { + Log.logException(e); + } + + // get the document from the old metadata index + if (this.urlIndexFile != null) try { + final Row.Entry entry = this.urlIndexFile.get(urlHash, false); + if (entry == null) return null; + return ClientUtils.toSolrDocument(getSolrScheme().metadata2solr(new URIMetadataRow(entry, wre, weight))); + } catch (final IOException e) { + Log.logException(e); + } + + return null; + } + + public void putMetadata(final URIMetadata entry) throws IOException { if (this.connectedSolr()) { try { SolrDocument sd = getSolr().get(ASCII.String(entry.url().hash())); @@ -530,7 +563,7 @@ public final class MetadataRepository implements Iterable { final TreeSet set = new TreeSet(); for (final URLHashCounter hs: domainSamples.values()) { if (hs == null) continue; - urlref = this.load(hs.urlhashb); + urlref = this.getMetadata(hs.urlhashb); if (urlref == null || urlref.url() == null || urlref.url().getHost() == null) continue; set.add(urlref.url().getHost()); count--; @@ -569,7 +602,7 @@ public final class MetadataRepository implements Iterable { } DigestURI url; for (final Map.Entry e: domainSamples.entrySet()) { - urlref = this.load(e.getValue().urlhashb); + urlref = this.getMetadata(e.getValue().urlhashb); url = urlref.url(); hostMap.put(e.getKey(), new HostStat(url.getHost(), url.getPort(), e.getKey(), hosthashScore.get(e.getKey()))); } @@ -591,7 +624,7 @@ public final class MetadataRepository implements Iterable { while (j.hasNext()) { urlhash = j.next(); if (urlhash == null) continue; - urlref = this.load(ASCII.getBytes(urlhash)); + urlref = this.getMetadata(ASCII.getBytes(urlhash)); if (urlref == null || urlref.url() == null || urlref.url().getHost() == null) continue; if (this.statsDump == null) return new ArrayList().iterator(); // some other operation has destroyed the object url = urlref.url(); diff --git a/source/net/yacy/search/index/Segment.java b/source/net/yacy/search/index/Segment.java index e876fcf9e..0573a71d6 100644 --- a/source/net/yacy/search/index/Segment.java +++ b/source/net/yacy/search/index/Segment.java @@ -287,7 +287,7 @@ public class Segment { } @Override public DigestURI next() { - URIMetadata umr = Segment.this.urlMetadata.load(bi.next()); + URIMetadata umr = Segment.this.urlMetadata.getMetadata(bi.next()); return umr.url(); } @Override @@ -463,7 +463,7 @@ public class Segment { Log.logWarning("SOLR", "failed to send " + urlNormalform + " to solr: " + e.getMessage()); } } else { - this.urlMetadata.store(metadata); + this.urlMetadata.putMetadata(metadata); } final long storageEndTime = System.currentTimeMillis(); @@ -568,7 +568,7 @@ public class Segment { if (urlhash == null) return 0; // determine the url string - final URIMetadata entry = urlMetadata().load(urlhash); + final URIMetadata entry = urlMetadata().getMetadata(urlhash); if (entry == null) return 0; if (entry.url() == null) return 0; diff --git a/source/net/yacy/search/query/RWIProcess.java b/source/net/yacy/search/query/RWIProcess.java index 60a75e275..71e37cb71 100644 --- a/source/net/yacy/search/query/RWIProcess.java +++ b/source/net/yacy/search/query/RWIProcess.java @@ -658,7 +658,7 @@ public final class RWIProcess extends Thread if ( obrwi == null ) { return null; // all time was already wasted in takeRWI to get another element } - final URIMetadata page = this.query.getSegment().urlMetadata().load(obrwi.getElement(), obrwi.getWeight()); + final URIMetadata page = this.query.getSegment().urlMetadata().getMetadata(obrwi.getElement(), obrwi.getWeight()); if ( page == null ) { try { this.misses.putUnique(obrwi.getElement().urlhash()); @@ -906,7 +906,7 @@ public final class RWIProcess extends Thread continue; } urlhash = this.hostResolver.get(hosthash); - row = urlhash == null ? null : this.query.getSegment().urlMetadata().load(urlhash); + row = urlhash == null ? null : this.query.getSegment().urlMetadata().getMetadata(urlhash); hostname = row == null ? null : row.url().getHost(); if ( hostname != null ) { result.set(hostname, this.hostNavigator.get(hosthash));