Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
replaced url and date retrieval by only url retrieval This should prevent that the search index is used for freshnes of the index entry.
Michael Peter Christenbd3f2483a1f3
diff --git a/htroot/IndexBrowser_p.java b/htroot/IndexBrowser_p.javaindex 1727e9f9d..58e5c426d 100644--- a/htroot/IndexBrowser_p.java+++ b/htroot/IndexBrowser_p.java@@ -81,15 +81,15 @@ public class IndexBrowser_p {/*** <p>Retrieve local index entries for a path, or for hosts with the most references. Also allow some maintaining operations on entries with load errors.</p>- * <p>Some parameters need administrator authentication or unauthenticated local host requests to be allowed : load, deleteLoadErrors, delete, reload404,+ * <p>Some parameters need administrator authentication or unauthenticated local host requests to be allowed : load, deleteLoadErrors, delete, reload404,* hosts="crawling" and hosts="error".* The "load" parameter can also be applied without authentication when "browser.load4everyone" configuration setting is true.</p>* <p>* Configuration settings :* <ul>- * <li>browser.autoload : allow the administrator to stack URLs to the local crawl queue, manually with the "load" parameter,+ * <li>browser.autoload : allow the administrator to stack URLs to the local crawl queue, manually with the "load" parameter,* or automatically when the "path" parameter is filled with an unknown URL</li>- * <li>browser.load4everyone : allow everyone to stack URLs to the local crawl queue.+ * <li>browser.load4everyone : allow everyone to stack URLs to the local crawl queue.* "browser.autoload" has also to be set to true to enable automatic loading on an unknown path</li>* <li>publicSearchpage : set to false to restrict use of this servlet to authenticated administrator only</li>* <li>decoration.hostanalysis : add supplementary hosts information for debug/analysis purpose</li>@@ -98,11 +98,11 @@ public class IndexBrowser_p {* </p>* @param header servlet request header* @param post request parameters. Supported keys :<ul>- * <li>path : root URL or host name to browse (ignored when the hosts parameter is filled). When not yet locally indexed, this URL can be automatically crawled and indexed+ * <li>path : root URL or host name to browse (ignored when the hosts parameter is filled). When not yet locally indexed, this URL can be automatically crawled and indexed* when "browser.autoload" or "browser.load4everyone" configuration settings are set to true.</li>* <li>load : URL to crawl and index.</li>* <li>deleteLoadErrors : delete from the local index documents with load error (HTTP status different from 200 or any other failure).</li>- * <li>hosts : generate hosts with most references list. Supported values :+ * <li>hosts : generate hosts with most references list. Supported values :* <ul>* <li>"crawling" : restrict to host currently crawled</li>* <li>"error" : restrict to hosts with having at least one resource load error</li>@@ -189,7 +189,7 @@ public class IndexBrowser_p {if (post.containsKey("deleteLoadErrors")) {try {- fulltext.getDefaultConnector().deleteByQuery("-" + CollectionSchema.httpstatus_i.getSolrFieldName() + ":200 AND "+ fulltext.getDefaultConnector().deleteByQuery("-" + CollectionSchema.httpstatus_i.getSolrFieldName() + ":200 AND "+ CollectionSchema.httpstatus_i.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM); // make sure field existsConcurrentLog.info ("IndexBrowser_p:", "delete documents with httpstatus_i <> 200");fulltext.getDefaultConnector().deleteByQuery(CollectionSchema.failtype_s.getSolrFieldName() + ":\"" + FailType.fail.name() + "\"" );@@ -689,13 +689,13 @@ public class IndexBrowser_p {// get all urls from the index and store them herefor (String id: internalIDs) {if (id.equals(urlhash)) continue; // no self-references- DigestURL u = fulltext.getURL(id);- if (u != null) references_internal_urls.add(u.toNormalform(true));+ String u = fulltext.getURL(id);+ if (u != null) this.references_internal_urls.add(u);}for (String id: externalIDs) {if (id.equals(urlhash)) continue; // no self-references- DigestURL u = fulltext.getURL(id);- if (u != null) references_external_urls.add(u.toNormalform(true));+ String u = fulltext.getURL(id);+ if (u != null) this.references_external_urls.add(u);}} catch (final IOException e) {}@@ -707,7 +707,7 @@ public class IndexBrowser_p {public String toString() {StringBuilder sbi = new StringBuilder();int c = 0;- for (String s: references_internal_urls) {+ for (String s: this.references_internal_urls) {sbi.append("<a href='").append(s).append("' target='_blank'><img src='env/grafics/i16.gif' alt='info' title='" + s + "' width='12' height='12'/></a>");c++;if (c % 80 == 0) sbi.append("<br/>");@@ -715,7 +715,7 @@ public class IndexBrowser_p {if (sbi.length() > 0) sbi.insert(0, "<br/>internal referrer:");StringBuilder sbe = new StringBuilder();c = 0;- for (String s: references_external_urls) {+ for (String s: this.references_external_urls) {sbe.append("<a href='").append(s).append("' target='_blank'><img src='env/grafics/i16.gif' alt='info' title='" + s + "' width='12' height='12'/></a>");c++;if (c % 80 == 0) sbe.append("<br/>");diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.javaindex 6cc786262..a66b9fe27 100644--- a/htroot/IndexControlRWIs_p.java+++ b/htroot/IndexControlRWIs_p.java@@ -78,7 +78,7 @@ import net.yacy.server.serverObjects;import net.yacy.server.serverSwitch;public class IndexControlRWIs_p {-+private static final String APP_NAME = "IndexControlRWIs_p";private final static String errmsg = "not possible to compute word from hash";@@ -162,7 +162,7 @@ public class IndexControlRWIs_p {if ( post.containsKey("maxReferencesLimit") ) {/* Check the transaction is valid */TransactionManager.checkPostTransaction(header, post);-+if ( post.get("maxReferencesRadio", "").equals("on") ) {ReferenceContainer.maxReferences = post.getInt("maxReferences", 0);} else {@@ -175,7 +175,7 @@ public class IndexControlRWIs_p {if ( post.containsKey("keyhashdeleteall") ) {/* Check the transaction is valid */TransactionManager.checkPostTransaction(header, post);-+try {if ( delurl || delurlref ) {// generate urlx: an array of url hashes to be deleted@@ -261,7 +261,7 @@ public class IndexControlRWIs_p {if ( post.containsKey("keyhashtransfer") ) {/* Check the transaction is valid */TransactionManager.checkPostTransaction(header, post);-+try {if ( keystring.isEmpty() || !Arrays.equals(Word.word2hash(keystring), keyhash) ) {prop.put("keystring", "<" + errmsg + ">");@@ -404,7 +404,8 @@ public class IndexControlRWIs_p {ConcurrentLog.logException(e);}try {- url = segment.fulltext().getURL(ASCII.String(b));+ String u = segment.fulltext().getURL(ASCII.String(b));+ url = u == null ? null : new DigestURL(u);segment.fulltext().remove(b);if ( url != null ) {items.add(new BlacklistHostAndPath(url.getHost(), url.getFile()));@@ -439,7 +440,8 @@ public class IndexControlRWIs_p {ConcurrentLog.logException(e);}try {- url = segment.fulltext().getURL(ASCII.String(b));+ String u = segment.fulltext().getURL(ASCII.String(b));+ url = u == null ? null : new DigestURL(u);segment.fulltext().remove(b);if ( url != null ) {for ( final BlacklistType supportedBlacklistType : BlacklistType.values() ) {@@ -473,7 +475,7 @@ public class IndexControlRWIs_p {if ( prop.getInt("searchresult", 0) == 3 ) {/* Acquire a transaction token for the next available POST form submissions */prop.put("searchresult_" + TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));-+listHosts(prop, keyhash, sb);}}@@ -653,8 +655,8 @@ public class IndexControlRWIs_p {final Switchboard sb,final byte[] keyhash,final Bitfield filter) {-- final HandleSet queryhashes = QueryParams.hashes2Set(ASCII.String(keyhash));++ final HandleSet queryhashes = QueryParams.hashes2Set(ASCII.String(keyhash));final QueryGoal qg = new QueryGoal(queryhashes, null);final QueryParams query = new QueryParams(qg,@@ -666,7 +668,7 @@ public class IndexControlRWIs_p {0, //timezoneOffsetnull,CacheStrategy.IFFRESH,- 1000, 0, //count, offset+ 1000, 0, //count, offset".*", //urlmasknull,null,@@ -675,14 +677,14 @@ public class IndexControlRWIs_p {false,null,MultiProtocolURL.TLD_any_zone_filter,- "",+ "",false,sb.index,sb.getRanking(),"",//userAgent0.0d, 0.0d, 0.0d,- new HashSet<>());- final SearchEvent theSearch = SearchEventCache.getEvent(query, sb.peers, sb.tables, null, false, sb.loader, Integer.MAX_VALUE, Long.MAX_VALUE);+ new HashSet<>());+ final SearchEvent theSearch = SearchEventCache.getEvent(query, sb.peers, sb.tables, null, false, sb.loader, Integer.MAX_VALUE, Long.MAX_VALUE);if (theSearch.rwiProcess != null && theSearch.rwiProcess.isAlive()) try {theSearch.rwiProcess.join();} catch (final InterruptedException e) {}if (theSearch.local_rwi_available.get() == 0) {prop.put("searchresult", 2);diff --git a/htroot/IndexControlURLs_p.java b/htroot/IndexControlURLs_p.javaindex 25cf668da..446e77aa4 100644--- a/htroot/IndexControlURLs_p.java+++ b/htroot/IndexControlURLs_p.java@@ -173,16 +173,15 @@ public class IndexControlURLs_p {/* Check the transaction is valid */TransactionManager.checkPostTransaction(header, post);- DigestURL url;+ String url;try {url = segment.fulltext().getURL(urlhash);if (url == null) {prop.putHTML("result", "No Entry for URL hash " + urlhash + "; nothing deleted.");} else {- urlstring = url.toNormalform(true);prop.put("urlstring", "");sb.urlRemove(segment, urlhash.getBytes());- prop.putHTML("result", "Removed URL " + urlstring);+ prop.putHTML("result", "Removed URL " + url);}} catch (IOException e) {prop.putHTML("result", "Error when querying the url hash " + urlhash + ":" + e.getMessage());diff --git a/htroot/Load_RSS_p.java b/htroot/Load_RSS_p.javaindex 81d9b8667..531368380 100644--- a/htroot/Load_RSS_p.java+++ b/htroot/Load_RSS_p.java@@ -59,13 +59,13 @@ import net.yacy.server.serverObjects;import net.yacy.server.serverSwitch;public class Load_RSS_p {-+/** Value prefix of checkbox inputs used to select items */private static final String CHECKBOX_ITEM_PREFIX = "mark_";-+/** Value prefix of checkbox inputs used to select media items */private static final String CHECKBOX_MEDIA_ITEM_PREFIX = "media_";-+public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, final serverObjects post, final serverSwitch env) {final serverObjects prop = new serverObjects();@@ -82,7 +82,7 @@ public class Load_RSS_p {prop.put("showscheduledfeeds", 0);prop.put("url", "");prop.put("showerrmsg", 0);-+if (post != null && post.containsKey("removeSelectedFeedsNewList")) {for (final Map.Entry<String, String> entry: post.entrySet()) {if (entry.getValue().startsWith(CHECKBOX_ITEM_PREFIX)) try {@@ -213,7 +213,7 @@ public class Load_RSS_p {messageurl = row.get("url", "");if (messageurl.isEmpty()) continue;// get referrer- final DigestURL referrer = sb.getURL(row.get("referrer", "").getBytes());+ final String referrerURL = sb.getURL(row.get("referrer", "").getBytes());// check if feed is registered in schedulerfinal byte[] api_pk = row.get("api_pk");final Row r = api_pk == null ? null : sb.tables.select("api", api_pk);@@ -224,7 +224,7 @@ public class Load_RSS_p {prop.put("showscheduledfeeds_list_" + apic + "_count", apic);prop.put("showscheduledfeeds_list_" + apic + "_rss", MultiProtocolURL.escape(messageurl).toString());prop.putXML("showscheduledfeeds_list_" + apic + "_title", row.get("title", ""));- prop.putXML("showscheduledfeeds_list_" + apic + "_referrer", referrer == null ? "#" : referrer.toNormalform(true));+ prop.putXML("showscheduledfeeds_list_" + apic + "_referrer", referrerURL == null ? "#" : referrerURL);prop.put("showscheduledfeeds_list_" + apic + "_recording", DateFormat.getDateTimeInstance().format(row.get("recording_date", new Date())));prop.put("showscheduledfeeds_list_" + apic + "_lastload", DateFormat.getDateTimeInstance().format(row.get("last_load_date", new Date())));prop.put("showscheduledfeeds_list_" + apic + "_nextload", date_next_exec == null ? "" : DateFormat.getDateTimeInstance().format(date_next_exec));@@ -238,7 +238,7 @@ public class Load_RSS_p {prop.put("shownewfeeds_list_" + newc + "_count", newc);prop.putXML("shownewfeeds_list_" + newc + "_rss", messageurl);prop.putXML("shownewfeeds_list_" + newc + "_title", row.get("title", ""));- prop.putXML("shownewfeeds_list_" + newc + "_referrer", referrer == null ? "" : referrer.toNormalform(true));+ prop.putXML("shownewfeeds_list_" + newc + "_referrer", referrerURL == null ? "" : referrerURL);prop.put("shownewfeeds_list_" + newc + "_recording", DateFormat.getDateTimeInstance().format(row.get("recording_date", new Date())));newc++;}@@ -275,7 +275,7 @@ public class Load_RSS_p {}ClientIdentification.Agent agent = post == null ? ClientIdentification.yacyInternetCrawlerAgent : ClientIdentification.getAgent(post.get("agentName", ClientIdentification.yacyInternetCrawlerAgentName));-+// if we have an url then try to load the rssRSSReader rss = null;if (url != null) try {@@ -333,7 +333,7 @@ public class Load_RSS_p {hash2UrlMap.put(ASCII.String(mediaUrl.hash()), mediaUrl);}}-+final List<DigestURL> urlsToIndex = new ArrayList<DigestURL>();loop: for (final Map.Entry<String, DigestURL> entry: hash2UrlMap.entrySet()) {final DigestURL messageUrl = entry.getValue();@@ -344,7 +344,7 @@ public class Load_RSS_p {urlsToIndex.add(messageUrl);RSSLoader.indexTriggered.insertIfAbsent(messageUrl.hash(), new Date());}-+sb.addToIndex(urlsToIndex, null, null, collections, true);}@@ -387,7 +387,7 @@ public class Load_RSS_p {ConcurrentLog.warn("Load_RSS", "Malformed feed item link URL : " + linkStr);}}-+DigestURL enclosure = null;final String enclosureStr = item.getEnclosure();if(StringUtils.isNotBlank(enclosureStr)) {@@ -397,7 +397,7 @@ public class Load_RSS_p {ConcurrentLog.warn("Load_RSS", "Malformed feed item enclosure URL : " + enclosureStr);}}-+if(link == null) {/* No link in this feed item : we use the enclosure media URL as the main link */link = enclosure;@@ -408,10 +408,10 @@ public class Load_RSS_p {author = item.getCopyright();}pubDate = item.getPubDate();-+if(link != null && StringUtils.isNotEmpty(item.getGuid())) {HarvestProcess harvestProcess = sb.getHarvestProcess(ASCII.String(link.hash()));-+prop.put("showitems_item_" + i + "_hasLink", true);prop.putHTML("showitems_item_" + i + "_hasLink_link", link.toNormalform(true));final int state = harvestProcess != null ? 2 : RSSLoader.indexTriggered.containsKey(link.hash()) ? 1 : 0;@@ -431,10 +431,10 @@ public class Load_RSS_p {prop.putHTML("showitems_item_" + i + "_language", item.getLanguage());prop.putHTML("showitems_item_" + i + "_date", (pubDate == null) ? "" : DateFormat.getDateTimeInstance().format(pubDate));i++;-+if(enclosure != null && enclosure != link && StringUtils.isNotEmpty(item.getGuid())) {HarvestProcess harvestProcess = sb.getHarvestProcess(ASCII.String(enclosure.hash()));-+prop.put("showitems_item_" + i + "_hasLink", true);prop.putHTML("showitems_item_" + i + "_hasLink_link", enclosure.toNormalform(true));final int state = harvestProcess != null ? 2 : RSSLoader.indexTriggered.containsKey(enclosure.hash()) ? 1 : 0;diff --git a/htroot/api/citation.java b/htroot/api/citation.javaindex 8479b55f3..29a13c9de 100644--- a/htroot/api/citation.java+++ b/htroot/api/citation.java@@ -90,11 +90,12 @@ public class citation {}if (uri == null && hash.length() > 0) {try {- uri = sb.getURL(ASCII.getBytes(hash));- if (uri == null) {+ String u = sb.getURL(ASCII.getBytes(hash));+ if (u == null) {connector.commit(true); // try again, that url can be fresh- uri = sb.getURL(ASCII.getBytes(hash));+ u = sb.getURL(ASCII.getBytes(hash));}+ if (u != null) uri = new DigestURL(u);} catch (IOException e) {ConcurrentLog.logException(e);}@@ -102,7 +103,7 @@ public class citation {if (uri == null) return prop; // no proper url addressedurl = uri.toNormalform(true);prop.put("url", url);-+// get the document from the indexSolrDocument doc;try {@@ -149,11 +150,11 @@ public class citation {sentenceOcc.put(sentence, list);}} catch (final Throwable ee) {-+}}sentences.clear(); // we do not need this again-+// iterate the sentencesint i = 0;int sentenceNr = 0;@@ -189,7 +190,7 @@ public class citation {sentenceNr++;}prop.put("sentences", i);-+// iterate the citations in order of number of citationsi = 0;for (String u: scores.keyList(false)) {@@ -207,7 +208,7 @@ public class citation {} catch (final MalformedURLException e) {}}prop.put("citations", i);-+// find similar documents from different hostsi = 0;for (String u: scores.keyList(false)) {@@ -221,7 +222,7 @@ public class citation {}prop.put("similar_links", i);prop.put("similar", i > 0 ? 1 : 0);-+// return rewrite propertiesreturn prop;}diff --git a/htroot/api/linkstructure.java b/htroot/api/linkstructure.javaindex d69271fbe..62e85f92f 100644--- a/htroot/api/linkstructure.java+++ b/htroot/api/linkstructure.java@@ -62,7 +62,8 @@ public class linkstructure {if (about.length() == 12 && Base64Order.enhancedCoder.wellformed(ASCII.getBytes(about))) {byte[] urlhash = ASCII.getBytes(about);try {- url = authenticated ? sb.getURL(urlhash) : null;+ String u = authenticated ? sb.getURL(urlhash) : null;+ url = u == null ? null : new DigestURL(u);} catch (IOException e) {ConcurrentLog.logException(e);}diff --git a/htroot/api/snapshot.java b/htroot/api/snapshot.javaindex 8ffb7a883..a47475810 100644--- a/htroot/api/snapshot.java+++ b/htroot/api/snapshot.java@@ -60,7 +60,7 @@ import net.yacy.server.serverObjects;import net.yacy.server.serverSwitch;public class snapshot {-+//width = 1024, height = 1024, density = 300, quality = 75private final static int DEFAULT_WIDTH = 1024;private final static int DEFAULT_HEIGHT = 1024;@@ -70,19 +70,19 @@ public class snapshot {public static Object respond(final RequestHeader header, serverObjects post, final serverSwitch env) {final Switchboard sb = (Switchboard) env;-+final serverObjects defaultResponse = new serverObjects();-+final boolean authenticated = sb.adminAuthenticated(header) >= 2;final String ext = header.get(HeaderFramework.CONNECTION_PROP_EXT, "");-+if(ext.isEmpty()) {throw new TemplateProcessingException("Missing extension. Try with rss, xml, json, pdf, png or jpg." + ext,HttpStatus.SC_BAD_REQUEST);}--++if (ext.equals("rss")) {// create a report about the content of the snapshot directoryif (!authenticated) {@@ -103,9 +103,9 @@ public class snapshot {rssfeed.setChannel(new RSSMessage("Snapshot list for host = " + host + ", depth = " + depth + ", order = " + order + ", maxcount = " + maxcount, "", ""));for (Map.Entry<String, Revisions> e: iddate.entrySet()) {try {- DigestURL u = e.getValue().url == null ? sb.index.fulltext().getURL(e.getKey()) : new DigestURL(e.getValue().url);+ String u = e.getValue().url == null ? sb.index.fulltext().getURL(e.getKey()) : e.getValue().url;if (u == null) continue;- RSSMessage message = new RSSMessage(u.toNormalform(true), "", u, e.getKey());+ RSSMessage message = new RSSMessage(u, "", new DigestURL(u), e.getKey());message.setPubDate(e.getValue().dates[0]);rssfeed.addMessage(message);} catch (IOException ee) {@@ -137,7 +137,8 @@ public class snapshot {}if (durl == null && urlhash.length() > 0) {try {- durl = sb.index.fulltext().getURL(urlhash);+ String u = sb.index.fulltext().getURL(urlhash);+ durl = u == null ? null : new DigestURL(u);} catch (IOException e) {ConcurrentLog.logException(e);}@@ -183,8 +184,8 @@ public class snapshot {for (Revisions r: entry.getValue()) {try {JSONObject metadata = new JSONObject();- DigestURL u = r.url != null ? new DigestURL(r.url) : sb.index.fulltext().getURL(r.urlhash);- metadata.put("url", u == null ? "unknown" : u.toNormalform(true));+ String u = r.url != null ? r.url : sb.index.fulltext().getURL(r.urlhash);+ metadata.put("url", u == null ? "unknown" : u);metadata.put("dates", r.dates);assert r.depth == entry.getKey().intValue();metadata.put("depth", entry.getKey().intValue());@@ -239,9 +240,8 @@ public class snapshot {}if (r != null) {JSONObject metadata = new JSONObject();- DigestURL u;- u = r.url != null ? new DigestURL(r.url) : sb.index.fulltext().getURL(r.urlhash);- metadata.put("url", u == null ? "unknown" : u.toNormalform(true));+ String u = r.url != null ? r.url : sb.index.fulltext().getURL(r.urlhash);+ metadata.put("url", u == null ? "unknown" : u);metadata.put("dates", r.dates);metadata.put("depth", r.depth);metadata.put("state", state.name());@@ -256,12 +256,12 @@ public class snapshot {if (post.containsKey("callback")) json = post.get("callback") + "([" + json + "]);";return new ByteArrayInputStream(UTF8.getBytes(json));}-+// for the following methods we always need the durl to fetch dataif (durl == null) {throw new TemplateMissingParameterException("Missing valid url or urlhash parameter");}-+if (xml) {Collection<File> xmlSnapshots = Transactions.findPaths(durl, "xml", Transactions.State.ANY);File xmlFile = null;@@ -277,7 +277,7 @@ public class snapshot {throw new TemplateProcessingException("Could not read the xml snapshot file.");}}-+if (pdf || pngjpg) {Collection<File> pdfSnapshots = Transactions.findPaths(durl, "pdf", Transactions.State.INVENTORY);File pdfFile = null;@@ -319,7 +319,7 @@ public class snapshot {throw new TemplateProcessingException("Could not read the pdf snapshot file.");}}-+if (pngjpg) {int width = Math.min(post.getInt("width", DEFAULT_WIDTH), DEFAULT_WIDTH);int height = Math.min(post.getInt("height", DEFAULT_HEIGHT), DEFAULT_HEIGHT);@@ -357,7 +357,7 @@ public class snapshot {final MediaTracker mediaTracker = new MediaTracker(new Container());mediaTracker.addImage(scaled, 0);try {mediaTracker.waitForID(0);} catch (final InterruptedException e) {}-+/** Ensure there is no alpha component on the ouput image, as it is pointless* here and it is not well supported by the JPEGImageWriter from OpenJDK@@ -369,10 +369,10 @@ public class snapshot {ConcurrentLog.logException(e);throw new TemplateProcessingException("Could not scale the " + ext + " image snapshot file.");}-+}}-+throw new TemplateProcessingException("Unsupported extension : " + ext + ". Try with rss, xml, json, pdf, png or jpg.",HttpStatus.SC_BAD_REQUEST);diff --git a/htroot/api/webstructure.java b/htroot/api/webstructure.javaindex 84eec8f53..e1cbf59d9 100644--- a/htroot/api/webstructure.java+++ b/htroot/api/webstructure.java@@ -52,64 +52,64 @@ import net.yacy.server.serverSwitch;*/public class webstructure {- /**- * <p>Retrieve the locally known web links structure of a specified resource ("about" parameter supplied) or- * the whole computed links structure since install (no parameter supplied)- * or since last start or last call ("latest" parameter supplied).</p>- * <p>Returned object contains the following information :- * <ul>- * <li>in all cases :- * <ul>- * <li>accumulated list of outgoing links to other domains (per host accumulated anchors)</li>- * </ul>- * </li>- * <li>when "about" parameter is filled :- * <ul>- * <li>accumulated list of incoming links from other domains (per host accumulated references)</li>- * <li>detailed list of outgoing links (anchors) from document at "about" URL to references</li>- * <li>detailed list of incoming links (citations) from other documents (their references) - reverse link structure</li>- * </ul>- * </li>- * </ul>- * <p>- * Remarks :- * <ul>- * <li>Information detail is limited by {@link WebStructureGraph#maxhosts}, {@link WebStructureGraph#maxref} and {@link WebStructureGraph#MAX_PARSED_ANCHORS} constants.</li>- * <li>Requesting client must be authenticated (as admin or requesting from localhost enabled) otherwise results will be empty</li>- * </ul>- * </p>- *- * <p>- * Example API calls :- * <ul>- * <li>domain name and index page structure : http://localhost:8090/api/webstructure.xml?about=yacy.net</li>- * <li>domain name structure : http://localhost:8090/api/webstructure.xml?about=yacy.net&documentStructure=false</li>+ /**+ * <p>Retrieve the locally known web links structure of a specified resource ("about" parameter supplied) or+ * the whole computed links structure since install (no parameter supplied)+ * or since last start or last call ("latest" parameter supplied).</p>+ * <p>Returned object contains the following information :+ * <ul>+ * <li>in all cases :+ * <ul>+ * <li>accumulated list of outgoing links to other domains (per host accumulated anchors)</li>+ * </ul>+ * </li>+ * <li>when "about" parameter is filled :+ * <ul>+ * <li>accumulated list of incoming links from other domains (per host accumulated references)</li>+ * <li>detailed list of outgoing links (anchors) from document at "about" URL to references</li>+ * <li>detailed list of incoming links (citations) from other documents (their references) - reverse link structure</li>+ * </ul>+ * </li>+ * </ul>+ * <p>+ * Remarks :+ * <ul>+ * <li>Information detail is limited by {@link WebStructureGraph#maxhosts}, {@link WebStructureGraph#maxref} and {@link WebStructureGraph#MAX_PARSED_ANCHORS} constants.</li>+ * <li>Requesting client must be authenticated (as admin or requesting from localhost enabled) otherwise results will be empty</li>+ * </ul>+ * </p>+ *+ * <p>+ * Example API calls :+ * <ul>+ * <li>domain name and index page structure : http://localhost:8090/api/webstructure.xml?about=yacy.net</li>+ * <li>domain name structure : http://localhost:8090/api/webstructure.xml?about=yacy.net&documentStructure=false</li>* <li>hosts accumulated structure and specific resource structure : http://localhost:8090/api/webstructure.xml?about=http://yacy.net/fr/API.html</li>- * <li>whole locally known hosts web structure : http://localhost:8090/api/webstructure.xml</li>- * <li>recently locally computed hosts web structure : http://localhost:8090/api/webstructure.xml?latest=</li>- * </ul>- * </p>- *- *- * @param header- * servlet request header- * @param post- * request parameters. Supported keys :- * <ul>- * <li>about : get only links structure about the resource- * specified as value. Supported values : host hash, URL hash,- * host name or URL</li>- * <li>latest (ignored when about parameter is valued): get the structure that have been computed during- * the current run-time of YaCy, and with each next call only an- * update to the next list of references.</li>- * <li>agentName : name of the user agent string used to load the "about" resource</li>- * <li>documentStructure : set to false when you only want the hosts accumulated references for the "about" resource</li>- * </ul>- * @param env- * server environment- * @return the servlet answer object- * @see WebStructureGraph- */+ * <li>whole locally known hosts web structure : http://localhost:8090/api/webstructure.xml</li>+ * <li>recently locally computed hosts web structure : http://localhost:8090/api/webstructure.xml?latest=</li>+ * </ul>+ * </p>+ *+ *+ * @param header+ * servlet request header+ * @param post+ * request parameters. Supported keys :+ * <ul>+ * <li>about : get only links structure about the resource+ * specified as value. Supported values : host hash, URL hash,+ * host name or URL</li>+ * <li>latest (ignored when about parameter is valued): get the structure that have been computed during+ * the current run-time of YaCy, and with each next call only an+ * update to the next list of references.</li>+ * <li>agentName : name of the user agent string used to load the "about" resource</li>+ * <li>documentStructure : set to false when you only want the hosts accumulated references for the "about" resource</li>+ * </ul>+ * @param env+ * server environment+ * @return the servlet answer object+ * @see WebStructureGraph+ */public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {final serverObjects prop = new serverObjects();final Switchboard sb = (Switchboard) env;@@ -124,25 +124,26 @@ public class webstructure {byte[] urlhash = null;Set<String> hostHashes = new HashSet<>();if (about.length() == 6 && Base64Order.enhancedCoder.wellformed(ASCII.getBytes(about))) {- hostHashes.add(about);+ hostHashes.add(about);} else if (about.length() == 12 && Base64Order.enhancedCoder.wellformed(ASCII.getBytes(about))) {- urlhash = ASCII.getBytes(about);- hostHashes.add(about.substring(6));- try {- url = authenticated ? sb.getURL(urlhash) : null;+ urlhash = ASCII.getBytes(about);+ hostHashes.add(about.substring(6));+ if (authenticated) try {+ String u = sb.getURL(urlhash);+ url = u == null ? null : new DigestURL(u);} catch (IOException e) {url = null;ConcurrentLog.logException(e);}} else if (about.length() > 0) {- // consider "about" as url or hostname+ // consider "about" as url or hostnametry {url = new DigestURL(about.indexOf("://") >= 0 ? about : "http://" + about); // accept also domainsurlhash = url.hash();if(about.indexOf("://") >= 0) {- hostHashes.add(url.hosthash());+ hostHashes.add(url.hosthash());} else {- hostHashes.addAll(sb.webStructure.hostName2HostHashes(about));+ hostHashes.addAll(sb.webStructure.hostName2HostHashes(about));}} catch (final MalformedURLException e) {}@@ -152,37 +153,37 @@ public class webstructure {prop.put("in", 1);int inCount = 0, outCount = 0;for(final String hostHash: hostHashes) {- WebStructureGraph.StructureEntry sentry = sb.webStructure.outgoingReferences(hostHash);- if (sentry != null && sentry.references.size() > 0) {- reference(prop, "out", outCount, sentry, sb.webStructure);- outCount++;- } else {- prop.put("out_domains", 0);- }- sentry = sb.webStructure.incomingReferences(hostHash);- if (sentry != null && sentry.references.size() > 0) {- reference(prop, "in", inCount, sentry, sb.webStructure);- prop.put("in_domains", 1);- inCount++;- } else {- prop.put("in_domains", 0);- }+ WebStructureGraph.StructureEntry sentry = sb.webStructure.outgoingReferences(hostHash);+ if (sentry != null && sentry.references.size() > 0) {+ reference(prop, "out", outCount, sentry, sb.webStructure);+ outCount++;+ } else {+ prop.put("out_domains", 0);+ }+ sentry = sb.webStructure.incomingReferences(hostHash);+ if (sentry != null && sentry.references.size() > 0) {+ reference(prop, "in", inCount, sentry, sb.webStructure);+ prop.put("in_domains", 1);+ inCount++;+ } else {+ prop.put("in_domains", 0);+ }}- prop.put("out_domains", outCount);- prop.put("in_domains", inCount);+ prop.put("out_domains", outCount);+ prop.put("in_domains", inCount);}-- /*- * It is possible not to scrape document and look for citations by- * setting documentStructure parameter to "false"- */- boolean documentStructure = true;- if (post != null && "false".equals(post.get("documentStructure", "true"))) {- documentStructure = false;- }-++ /*+ * It is possible not to scrape document and look for citations by+ * setting documentStructure parameter to "false"+ */+ boolean documentStructure = true;+ if (post != null && "false".equals(post.get("documentStructure", "true"))) {+ documentStructure = false;+ }+if (urlhash != null && documentStructure) {- // anchors+ // anchorsprop.put("references", 1);net.yacy.document.Document scraper = null;if (url != null) try {@@ -201,36 +202,36 @@ public class webstructure {if (url != null) prop.putXML("references_documents_0_urle_url", url.toNormalform(true));int d = 0;Iterator<DigestURL> i = scraper.inboundLinks().keySet().iterator();- while (i.hasNext()) {- DigestURL refurl = i.next();- byte[] refhash = refurl.hash();- prop.putXML("references_documents_0_anchors_" + d + "_url", refurl.toNormalform(true));- prop.put("references_documents_0_anchors_" + d + "_hash", refhash);- prop.put("references_documents_0_anchors_" + d + "_outbound", 0);- d++;- }+ while (i.hasNext()) {+ DigestURL refurl = i.next();+ byte[] refhash = refurl.hash();+ prop.putXML("references_documents_0_anchors_" + d + "_url", refurl.toNormalform(true));+ prop.put("references_documents_0_anchors_" + d + "_hash", refhash);+ prop.put("references_documents_0_anchors_" + d + "_outbound", 0);+ d++;+ }i = scraper.outboundLinks().keySet().iterator();- while (i.hasNext()) {- DigestURL refurl = i.next();- byte[] refhash = refurl.hash();- prop.putXML("references_documents_0_anchors_" + d + "_url", refurl.toNormalform(true));- prop.put("references_documents_0_anchors_" + d + "_hash", refhash);- prop.put("references_documents_0_anchors_" + d + "_outbound", 1);- d++;- }+ while (i.hasNext()) {+ DigestURL refurl = i.next();+ byte[] refhash = refurl.hash();+ prop.putXML("references_documents_0_anchors_" + d + "_url", refurl.toNormalform(true));+ prop.put("references_documents_0_anchors_" + d + "_hash", refhash);+ prop.put("references_documents_0_anchors_" + d + "_outbound", 1);+ d++;+ }prop.put("references_documents_0_count", d);prop.put("references_documents_0_anchors", d);} else {prop.put("references_count", 0);prop.put("references_documents", 0);- }+ }// citationsprop.put("citations", 1);ReferenceReportCache rrc = sb.index.getReferenceReportCache();ReferenceReport rr = null;try {rr = rrc.getReferenceReport(ASCII.String(urlhash), true);} catch (IOException e) {}- if (rr != null && rr.getInternalCount() > 0 && rr.getExternalCount() > 0) {+ if (rr != null && rr.getInternalCount() > 0 && rr.getExternalCount() > 0) {prop.put("citations_count", 1);prop.put("citations_documents", 1);prop.put("citations_documents_0_hash", urlhash);@@ -242,26 +243,26 @@ public class webstructure {HandleSet ids = rr.getInternallIDs();try {ids.putAll(rr.getExternalIDs());} catch (SpaceExceededException e) {}Iterator<byte[]> i = ids.iterator();- while (i.hasNext()) {- byte[] refhash = i.next();- DigestURL refurl;+ while (i.hasNext()) {+ byte[] refhash = i.next();+ String refurl;try {refurl = authenticated ? sb.getURL(refhash) : null;prop.put("citations_documents_0_anchors_" + d + "_urle", refurl == null ? 0 : 1);- if (refurl != null) prop.putXML("citations_documents_0_anchors_" + d + "_urle_url", refurl.toNormalform(true));+ if (refurl != null) prop.putXML("citations_documents_0_anchors_" + d + "_urle_url", refurl);prop.put("citations_documents_0_anchors_" + d + "_urle_hash", refhash);prop.put("citations_documents_0_anchors_" + d + "_urle_date", GenericFormatter.SHORT_DAY_FORMATTER.format(new Date())); // superfluous?d++;} catch (IOException e) {ConcurrentLog.logException(e);}- }+ }prop.put("citations_documents_0_count", d);prop.put("citations_documents_0_anchors", d);- } else {+ } else {prop.put("citations_count", 0);prop.put("citations_documents", 0);- }+ }}} else if (authenticated) {// show a complete list of link structure informations in case that the user is authenticateddiff --git a/htroot/yacy/urls.java b/htroot/yacy/urls.javaindex fb3eb7023..85cba5275 100644--- a/htroot/yacy/urls.java+++ b/htroot/yacy/urls.java@@ -25,9 +25,9 @@// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USAimport java.io.IOException;+import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.document.encoding.ASCII;-import net.yacy.cora.document.id.DigestURL;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.util.ConcurrentLog;import net.yacy.crawler.data.NoticedURL;@@ -63,7 +63,7 @@ public class urls {final long timeout = System.currentTimeMillis() + maxTime;int c = 0;Request entry;- DigestURL referrer;+ String referrerURL;while ((maxCount > 0) &&(System.currentTimeMillis() < timeout) &&(!sb.crawlQueues.noticeURL.isEmpty(stackType))) {@@ -76,9 +76,9 @@ public class urls {// find referrer, if there is onetry {- referrer = sb.getURL(entry.referrerhash());+ referrerURL = sb.getURL(entry.referrerhash());} catch (IOException e) {- referrer = null;+ referrerURL = null;ConcurrentLog.logException(e);}@@ -88,7 +88,7 @@ public class urls {// create RSS entryprop.put("item_" + c + "_title", "");prop.putXML("item_" + c + "_link", entry.url().toNormalform(true));- prop.putXML("item_" + c + "_referrer", (referrer == null) ? "" : referrer.toNormalform(true));+ prop.putXML("item_" + c + "_referrer", (referrerURL == null) ? "" : referrerURL);prop.putXML("item_" + c + "_description", entry.name());prop.put("item_" + c + "_author", "");prop.put("item_" + c + "_pubDate", GenericFormatter.SHORT_SECOND_FORMATTER.format(entry.appdate()));@@ -107,17 +107,17 @@ public class urls {final int count = urlhashes.length() / 12;int c = 0;URIMetadataNode entry;- DigestURL referrer;+ String referrerURL;for (int i = 0; i < count; i++) {entry = sb.index.fulltext().getMetadata(ASCII.getBytes(urlhashes.substring(12 * i, 12 * (i + 1))));if (entry == null) continue;// find referrer, if there is onetry {- referrer = sb.getURL(entry.referrerHash());+ referrerURL = sb.getURL(entry.referrerHash());// create RSS entryprop.put("item_" + c + "_title", entry.dc_title());prop.putXML("item_" + c + "_link", entry.url().toNormalform(true));- prop.putXML("item_" + c + "_referrer", (referrer == null) ? "" : referrer.toNormalform(true));+ prop.putXML("item_" + c + "_referrer", (referrerURL == null) ? "" : referrerURL);prop.putXML("item_" + c + "_description", entry.dc_title());prop.put("item_" + c + "_author", entry.dc_creator());prop.put("item_" + c + "_pubDate", GenericFormatter.SHORT_SECOND_FORMATTER.format(entry.moddate()));diff --git a/source/net/yacy/cora/federate/solr/connector/AbstractSolrConnector.java b/source/net/yacy/cora/federate/solr/connector/AbstractSolrConnector.javaindex efb0298d2..90dc47859 100644--- a/source/net/yacy/cora/federate/solr/connector/AbstractSolrConnector.java+++ b/source/net/yacy/cora/federate/solr/connector/AbstractSolrConnector.java@@ -24,7 +24,6 @@ import java.io.IOException;import java.io.InterruptedIOException;import java.util.ArrayList;import java.util.Collection;-import java.util.Date;import java.util.HashMap;import java.util.HashSet;import java.util.Iterator;@@ -96,33 +95,20 @@ public abstract class AbstractSolrConnector implements SolrConnector {protected final static int pagesize_docs = 100;protected final static int pagesize_ids = 1000;- @Deprecated- protected static LoadTimeURL getLoadTimeURL(final Object doc) {+ protected static String getURL(final Object doc) {if (doc == null) return null;- Object d = null;String url = null;if (doc instanceof SolrInputDocument) {- d = ((SolrInputDocument) doc).getFieldValue(CollectionSchema.load_date_dt.getSolrFieldName());url = (String) ((SolrInputDocument) doc).getFieldValue(CollectionSchema.sku.getSolrFieldName());}if (doc instanceof SolrDocument) {- d = ((SolrDocument) doc).getFieldValue(CollectionSchema.load_date_dt.getSolrFieldName());url = (String) ((SolrDocument) doc).getFieldValue(CollectionSchema.sku.getSolrFieldName());}if (doc instanceof org.apache.lucene.document.Document) {- String ds = ((org.apache.lucene.document.Document) doc).get(CollectionSchema.load_date_dt.getSolrFieldName());- try {- d = Long.parseLong(ds);- } catch (NumberFormatException e) {- d = -1l;- }url = ((org.apache.lucene.document.Document) doc).get(CollectionSchema.sku.getSolrFieldName());}- if (d == null) return null;- long date = -1;- if (d instanceof Long) date = ((Long) d).longValue();- if (d instanceof Date) date = ((Date) d).getTime();- return new LoadTimeURL(url, date);+ if (url == null) return null;+ return url;}/**@@ -476,12 +462,11 @@ public abstract class AbstractSolrConnector implements SolrConnector {/*** check if a given document, identified by url hash as document id exists* @param id the url hash and document id- * @return metadata if any entry in solr exists, null otherwise+ * @return url if document exist or null otherwise* @throws IOException*/- @Deprecated@Override- public LoadTimeURL getLoadTimeURL(String id) throws IOException {+ public String getURL(String id) throws IOException {// construct raw queryfinal SolrQuery params = new SolrQuery();//params.setQuery(CollectionSchema.id.getSolrFieldName() + ":\"" + id + "\"");@@ -498,8 +483,7 @@ public abstract class AbstractSolrConnector implements SolrConnector {final SolrDocumentList sdl = getDocumentListByParams(params);if (sdl == null || sdl.getNumFound() <= 0) return null;SolrDocument doc = sdl.iterator().next();- LoadTimeURL md = getLoadTimeURL(doc);- return md;+ return getURL(doc);}/**diff --git a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.javaindex 77de53cf6..5839541ee 100644--- a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java+++ b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java@@ -425,14 +425,12 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo/*** check if a given document, identified by url hash as document id exists- * @Deprecated use Segment.getLastSeenTime instead* @param id the url hash and document id* @return the load date if any entry in solr exists, null otherwise* @throws IOException*/- @Deprecated@Override- public LoadTimeURL getLoadTimeURL(String id) throws IOException {+ public String getURL(String id) throws IOException {int responseCount = 0;DocListSearcher docListSearcher = null;try {@@ -444,7 +442,7 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo//for (int i = 0; i < responseCount; i++) {final Document doc = searcher.doc(iterator.nextDoc(), AbstractSolrConnector.SOLR_ID_and_LOAD_DATE_FIELDS);if (doc == null) return null;- return AbstractSolrConnector.getLoadTimeURL(doc);+ return AbstractSolrConnector.getURL(doc);//}} catch (final Throwable e) {ConcurrentLog.logException(e);diff --git a/source/net/yacy/cora/federate/solr/connector/MirrorSolrConnector.java b/source/net/yacy/cora/federate/solr/connector/MirrorSolrConnector.javaindex 6cc670f60..b46d13193 100644--- a/source/net/yacy/cora/federate/solr/connector/MirrorSolrConnector.java+++ b/source/net/yacy/cora/federate/solr/connector/MirrorSolrConnector.java@@ -418,21 +418,6 @@ public class MirrorSolrConnector extends AbstractSolrConnector implements SolrCoreturn result;}- @Deprecated- @Override- public LoadTimeURL getLoadTimeURL(String id) throws IOException {- if (this.solr0 != null && this.solr1 == null) return this.solr0.getLoadTimeURL(id);- if (this.solr0 == null && this.solr1 != null) return this.solr1.getLoadTimeURL(id);- if (this.solr0 == null && this.solr1 == null) return null;- LoadTimeURL md0 = this.solr0.getLoadTimeURL(id);- LoadTimeURL md1 = this.solr1.getLoadTimeURL(id);- if (md0 == null) return md1;- if (md1 == null) return md0;- long date = Math.max(md0.date, md1.date);- assert md0.url.equals(md1.url);- return new LoadTimeURL(md0.url, date);- }-@Overridepublic BlockingQueue<String> concurrentIDsByQuery(final String querystring, final String sort, final int offset, final int maxcount, final long maxtime, final int buffersize, final int concurrency) {if (this.solr0 != null && this.solr1 == null) return this.solr0.concurrentIDsByQuery(querystring, sort, offset, maxcount, maxtime, buffersize, concurrency);diff --git a/source/net/yacy/cora/federate/solr/connector/SolrConnector.java b/source/net/yacy/cora/federate/solr/connector/SolrConnector.javaindex 26a61c86c..ef2a61ad5 100644--- a/source/net/yacy/cora/federate/solr/connector/SolrConnector.java+++ b/source/net/yacy/cora/federate/solr/connector/SolrConnector.java@@ -37,15 +37,6 @@ import net.yacy.cora.sorting.ReversibleScoreMap;public interface SolrConnector extends Iterable<String> /* Iterable of document IDs */ {- public static class LoadTimeURL {- public long date;- public String url;- public LoadTimeURL(final String url, final long date) {- this.url = url;- this.date = date;- }- }-/*** clear all caches: inside solr and ouside solr within the implementations of this interface*/@@ -120,11 +111,10 @@ public interface SolrConnector extends Iterable<String> /* Iterable of document/*** check if a given document, identified by url hash as document id exists* @param id the url hash and document id- * @return the load time metadata (url and load data) if any entry in solr exists, null otherwise+ * @return the url if any entry in solr exists, null otherwise* @throws IOException*/- @Deprecated- public LoadTimeURL getLoadTimeURL(final String id) throws IOException;+ public String getURL(String id) throws IOException;/*** check if a given document, identified by url hash as document id existsdiff --git a/source/net/yacy/crawler/CrawlStacker.java b/source/net/yacy/crawler/CrawlStacker.javaindex 11192703b..643df9e00 100644--- a/source/net/yacy/crawler/CrawlStacker.java+++ b/source/net/yacy/crawler/CrawlStacker.java@@ -44,7 +44,6 @@ import net.yacy.cora.document.id.AnchorURL;import net.yacy.cora.document.id.DigestURL;import net.yacy.cora.document.id.MultiProtocolURL;import net.yacy.cora.federate.solr.FailCategory;-import net.yacy.cora.federate.solr.connector.SolrConnector.LoadTimeURL;import net.yacy.cora.order.Base64Order;import net.yacy.cora.protocol.Domains;import net.yacy.cora.protocol.ftp.FTPClient;@@ -426,7 +425,7 @@ public final class CrawlStacker implements WorkflowTask<Request>{return CRAWL_REJECT_REASON_DOUBLE_IN_PREFIX + ": " + dbocc.name();}String urls = url.toNormalform(false);- LoadTimeURL oldEntry = this.indexSegment.getLoadTimeURL(urls, url.hash());+ final long oldDate = this.indexSegment.getLoadTime(url.hash());// deny urls that exceed allowed number of occurrencesfinal int maxAllowedPagesPerDomain = profile.domMaxPages();@@ -445,16 +444,16 @@ public final class CrawlStacker implements WorkflowTask<Request>{*/}- final Long oldDate = oldEntry == null ? null : oldEntry.date;- if (oldDate == null) {+ //final Long oldDate = oldEntry == null ? null : oldEntry.date;+ if (oldDate < 0) {return null; // no evidence that we know that url}- final boolean recrawl = profile.recrawlIfOlder() > oldDate.longValue();+ final boolean recrawl = profile.recrawlIfOlder() > oldDate;final String urlstring = url.toNormalform(false);if (recrawl) {if (CrawlStacker.log.isFine())CrawlStacker.log.fine("RE-CRAWL of URL '" + urlstring + "': this url was crawled " +- ((System.currentTimeMillis() - oldDate.longValue()) / 60000 / 60 / 24) + " days ago.");+ ((System.currentTimeMillis() - oldDate) / 60000 / 60 / 24) + " days ago.");} else {return CRAWL_REJECT_REASON_DOUBLE_IN_PREFIX + ": local index, recrawl rejected. Document date = "+ ISO8601Formatter.FORMATTER.format(new Date(oldDate)) + " is not older than crawl profile recrawl minimum date = "diff --git a/source/net/yacy/crawler/retrieval/FTPLoader.java b/source/net/yacy/crawler/retrieval/FTPLoader.javaindex c17502c78..25fe870a4 100644--- a/source/net/yacy/crawler/retrieval/FTPLoader.java+++ b/source/net/yacy/crawler/retrieval/FTPLoader.java@@ -1,7 +1,7 @@// FTPLoader.java// -------------------------------------// part of YACY-// SPDX-FileCopyrightText: 2006 Michael Peter Christen <[email protected])>+// SPDX-FileCopyrightText: 2006 Michael Peter Christen <[email protected])>// SPDX-License-Identifier: GPL-2.0-or-later// first published on http://www.anomic.de// Frankfurt, Germany, 2006@@ -72,7 +72,7 @@ public class FTPLoader {public Response load(final Request request, final boolean acceptOnlyParseable) throws IOException {Latency.updateBeforeLoad(request.url());-+final long start = System.currentTimeMillis();final DigestURL entryUrl = request.url();final String fullPath = getPath(entryUrl);@@ -121,10 +121,10 @@ public class FTPLoader {// directory -> get list of filesRequestHeader requestHeader = null;if (request.referrerhash() != null) {- final DigestURL u = this.sb.getURL(request.referrerhash());+ final String u = this.sb.getURL(request.referrerhash());if (u != null) {requestHeader = new RequestHeader();- requestHeader.put(RequestHeader.REFERER, u.toNormalform(true));+ requestHeader.put(RequestHeader.REFERER, u);}}@@ -168,7 +168,7 @@ public class FTPLoader {Latency.updateAfterLoad(request.url(), System.currentTimeMillis() - start);return response;}-+/*** Open a stream on the entry content from a FTP server*@@ -187,7 +187,7 @@ public class FTPLoader {} else {/* content can be null when no parser can handle it : then return the URL tokens as content */streamResponse = new StreamResponse(response,- new ByteArrayInputStream(UTF8.getBytes(request.url().toTokens())));+ new ByteArrayInputStream(UTF8.getBytes(request.url().toTokens())));}return streamResponse;}@@ -253,10 +253,10 @@ public class FTPLoader {// create response headerRequestHeader requestHeader = null;if (request.referrerhash() != null) {- final DigestURL refurl = this.sb.getURL(request.referrerhash());+ final String refurl = this.sb.getURL(request.referrerhash());if (refurl != null) {requestHeader = new RequestHeader();- requestHeader.put(RequestHeader.REFERER, refurl.toNormalform(true));+ requestHeader.put(RequestHeader.REFERER, refurl);}}final ResponseHeader responseHeader = new ResponseHeader(200);diff --git a/source/net/yacy/crawler/retrieval/FileLoader.java b/source/net/yacy/crawler/retrieval/FileLoader.javaindex 994e5cedc..be5568fb6 100644--- a/source/net/yacy/crawler/retrieval/FileLoader.java+++ b/source/net/yacy/crawler/retrieval/FileLoader.java@@ -1,6 +1,6 @@/*** FileLoader- * SPDX-FileCopyrightText: 2010 Michael Peter Christen <[email protected])>+ * SPDX-FileCopyrightText: 2010 Michael Peter Christen <[email protected])>* SPDX-License-Identifier: GPL-2.0-or-later* First released 25.5.2010 at http://yacy.net*@@ -50,7 +50,7 @@ import net.yacy.kelondro.util.FileUtils;import net.yacy.search.Switchboard;public class FileLoader {-+/** Default maximum file size allowed for the crawler */public static final int DEFAULT_MAXFILESIZE = 100000000;@@ -73,14 +73,14 @@ public class FileLoader {*/public Response load(final Request request, boolean acceptOnlyParseable) throws IOException {StreamResponse streamResponse = openInputStream(request, acceptOnlyParseable);-+/* Read fully the stream and update the response */byte[] content = FileUtils.read(streamResponse.getContentStream());Response response = streamResponse.getResponse();response.setContent(content);return response;}-+/*** Open a stream on the requested file. When actual file size is over maxBytes, return a stream on metadata only (URL tokens).*@@ -95,10 +95,10 @@ public class FileLoader {RequestHeader requestHeader = null;if (request.referrerhash() != null) {- DigestURL ur = this.sb.getURL(request.referrerhash());+ String ur = this.sb.getURL(request.referrerhash());if (ur != null) {requestHeader = new RequestHeader();- requestHeader.put(RequestHeader.REFERER, ur.toNormalform(true));+ requestHeader.put(RequestHeader.REFERER, ur);}}@@ -171,7 +171,7 @@ public class FileLoader {// load the resourceInputStream is = url.getInputStream(ClientIdentification.yacyInternetCrawlerAgent);-+if(size < 0 && maxBytes >= 0) {/* If content length is unknown for some reason, let's apply now the eventual size restriction */is = new StrictLimitInputStream(is, maxBytes,@@ -189,7 +189,7 @@ public class FileLoader {null);return new StreamResponse(response, is);}-+/*** Open a stream on the requested file*diff --git a/source/net/yacy/crawler/retrieval/HTTPLoader.java b/source/net/yacy/crawler/retrieval/HTTPLoader.javaindex 7b16128d2..689e6f1b1 100644--- a/source/net/yacy/crawler/retrieval/HTTPLoader.java+++ b/source/net/yacy/crawler/retrieval/HTTPLoader.java@@ -310,9 +310,9 @@ public final class HTTPLoader {final RequestHeader requestHeader = new RequestHeader();requestHeader.put(HeaderFramework.USER_AGENT, agent.userAgent);if (request.referrerhash() != null) {- DigestURL refererURL = this.sb.getURL(request.referrerhash());+ String refererURL = this.sb.getURL(request.referrerhash());if (refererURL != null) {- requestHeader.put(RequestHeader.REFERER, refererURL.toNormalform(true));+ requestHeader.put(RequestHeader.REFERER, refererURL);}}diff --git a/source/net/yacy/crawler/retrieval/SMBLoader.java b/source/net/yacy/crawler/retrieval/SMBLoader.javaindex 36b7c34b2..6b624b33f 100644--- a/source/net/yacy/crawler/retrieval/SMBLoader.java+++ b/source/net/yacy/crawler/retrieval/SMBLoader.java@@ -1,5 +1,5 @@// SMBLoader.java-// SPDX-FileCopyrightText: 2010 Michael Peter Christen <[email protected])>+// SPDX-FileCopyrightText: 2010 Michael Peter Christen <[email protected])>// SPDX-License-Identifier: GPL-2.0-or-later// Frankfurt a. M., Germany// first published 10.03.2010 on http://yacy.net@@ -81,14 +81,14 @@ public class SMBLoader {*/public Response load(final Request request, boolean acceptOnlyParseable) throws IOException {StreamResponse streamResponse = openInputStream(request, acceptOnlyParseable);-+/* Read fully the stream and update the response */byte[] content = FileUtils.read(streamResponse.getContentStream());Response response = streamResponse.getResponse();response.setContent(content);return response;}-+/*** Open a stream on the requested file*@@ -102,10 +102,10 @@ public class SMBLoader {RequestHeader requestHeader = null;if (request.referrerhash() != null) {- DigestURL ur = this.sb.getURL(request.referrerhash());+ String ur = this.sb.getURL(request.referrerhash());if (ur != null) {requestHeader = new RequestHeader();- requestHeader.put(RequestHeader.REFERER, ur.toNormalform(true));+ requestHeader.put(RequestHeader.REFERER, ur);}}diff --git a/source/net/yacy/kelondro/data/meta/URIMetadataNode.java b/source/net/yacy/kelondro/data/meta/URIMetadataNode.javaindex 1313f15b4..33b797524 100644--- a/source/net/yacy/kelondro/data/meta/URIMetadataNode.java+++ b/source/net/yacy/kelondro/data/meta/URIMetadataNode.java@@ -84,9 +84,9 @@ import net.yacy.utils.crypt;* Future implementations should try to replace URIMetadata objects completely by SolrDocument objects*/public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMetadataNode>, Comparator<URIMetadataNode> */ {-+private static final long serialVersionUID = -256046934741561968L;-+protected String keywords = null;protected DigestURL url;protected Bitfield flags = null;@@ -113,7 +113,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe//System.out.println("DEBUG-ENTRY: prop=" + prop.toString());super();final String urlRaw = crypt.simpleDecode(prop.getProperty("url", ""));- url = new DigestURL(urlRaw);+ this.url = new DigestURL(urlRaw);String descr = crypt.simpleDecode(prop.getProperty("descr", "")); if (descr == null) descr = "";String dc_creator = crypt.simpleDecode(prop.getProperty("author", "")); if (dc_creator == null) dc_creator = "";String tags = crypt.simpleDecode(prop.getProperty("tags", "")); if (tags == null) tags = "";@@ -121,7 +121,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMeString dc_publisher = crypt.simpleDecode(prop.getProperty("publisher", "")); if (dc_publisher == null) dc_publisher = "";String lons = crypt.simpleDecode(prop.getProperty("lon"));String lats = crypt.simpleDecode(prop.getProperty("lat"));-+this.setField(CollectionSchema.title.name(), descr);this.setField(CollectionSchema.author.name(), dc_creator);this.setField(CollectionSchema.publisher_t.name(), dc_publisher);@@ -129,11 +129,8 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMethis.lat = (lats == null) ? 0.0d : Double.parseDouble(lats);this.setField(CollectionSchema.last_modified.name(), parseShortDayDate(prop.getProperty("mod", "20000101")));-this.setField(CollectionSchema.load_date_dt.name(), parseShortDayDate(prop.getProperty("load", "20000101")));-this.setField(CollectionSchema.fresh_date_dt.name(), parseShortDayDate(prop.getProperty("fresh", "20000101")));-this.setField(CollectionSchema.referrer_id_s.name(), prop.getProperty("referrer", ""));// this.setField(CollectionSchema.md5_s.name(), prop.getProperty("md5", "")); // always 0 (not used / calculated)this.setField(CollectionSchema.size_i.name(), Integer.parseInt(prop.getProperty("size", "0")));@@ -170,7 +167,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMethis.setIconsFields(faviconURL);}}-+public URIMetadataNode(final SolrDocument doc) throws MalformedURLException {super();@@ -213,11 +210,11 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMepublic URIMetadataNode(DigestURL theurl) {super();- url = theurl;- this.setField(CollectionSchema.sku.name(), url.toNormalform(true));- this.setField(CollectionSchema.id.name(), ASCII.String(url.hash()));+ this.url = theurl;+ this.setField(CollectionSchema.sku.name(), this.url.toNormalform(true));+ this.setField(CollectionSchema.id.name(), ASCII.String(this.url.hash()));}-+/*** Get the content domain of a document. This tries to get the content domain from the mime type* and if this fails it uses alternatively the content domain from the file extension.@@ -331,7 +328,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMeif (this.lat < -90.0d || this.lat > 90.0d) this.lat = 0.0d;}- if ( (p < latlon.length()-1) && (latlon.charAt(p+1) <= '9') ) {+ if ( (p < latlon.length()-1) && (latlon.charAt(p+1) <= '9') ) {this.lon=Double.parseDouble(latlon.substring(p + 1));if (this.lon < -180.0d || this.lon > 180.0d) this.lon = 0.0d;}@@ -424,7 +421,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe}public Bitfield flags() {- if (flags == null) {+ if (this.flags == null) {this.flags = new Bitfield();if (dc_subject() != null && dc_subject().indexOf("indexof") >= 0) this.flags.set(Tokenizer.flag_cat_indexof, true);ContentDomain cd = getContentDomain();@@ -456,7 +453,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMeString url = images_protocol.get(0) + "://" + images_stub.get(0);return url;}-+public int llocal() {return getInt(CollectionSchema.inboundlinkscount_i);}@@ -538,7 +535,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe}return list.iterator();}-+/*** Extracts icon entries from this solr document* @return icon entries collection eventually empty@@ -560,7 +557,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMeif (item instanceof String) {urlStub = (String) item;String iconURLStr = (ports != null && ports.size() > index ? ports.get(index) : "http") + "://" + urlStub;-+DigestURL iconURL;try {iconURL = new DigestURL(iconURLStr);@@ -588,14 +585,14 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMesizes = ContentScraper.parseSizes((String) item);}}-+icons.add(new IconEntry(iconURL, rels, sizes));}}}return icons;}-+/*** Try to extract icon entry with preferred size from this solr document.* We look preferably for a standard icon but accept as a fallback other icons.@@ -632,13 +629,13 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe}}}-+return faviconEntry;}-+/*** Use iconURL to set icons related field on this solr document.- *+ ** @param iconURL icon URL*/private void setIconsFields(DigestURL iconURL) {@@ -676,7 +673,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe}return list;}-+public static Date getDate(SolrDocument doc, final CollectionSchema key) {Date x = doc == null ? null : (Date) doc.getFieldValue(key.getSolrFieldName());Date now = new Date();@@ -698,10 +695,10 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMetext = null;return sentences;}-+public ArrayList<String> getDescription() {return getStringList(CollectionSchema.description_txt);- }+ }public static URIMetadataNode importEntry(final String propStr, String collection) {if (propStr == null || propStr.isEmpty() || propStr.charAt(0) != '{' || !propStr.endsWith("}")) {@@ -716,7 +713,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMereturn null;}}-+/*** Format a date using the short day format.* @param date the date to format. Must not be null.@@ -737,10 +734,10 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe}return formattedDate;}-+/*** Parse a date string with the short day format.- *+ ** @param dateStr* a date representation as a String. Must not be null.* @return the parsed Date or the current date when an parsing error occurred.@@ -761,7 +758,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe}return parsed;}-+protected StringBuilder corePropList() {// generate a parseable string; this is a simple property-listfinal StringBuilder s = new StringBuilder(300);@@ -854,7 +851,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMecore.append('}');return core.toString();}-+private int getInt(CollectionSchema field) {assert !field.isMultiValued();assert field.getType() == SolrType.num_integer;@@ -909,7 +906,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMea.add((String) r);return a;}-+@SuppressWarnings("unchecked")private ArrayList<Integer> getIntList(CollectionSchema field) {assert field.isMultiValued();@@ -983,7 +980,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe*/public String urlstring() {if (this.alternative_urlstring != null) return this.alternative_urlstring;-+if (!pdfParser.individualPages) return this.url().toNormalform(true);if (!"pdf".equals(MultiProtocolURL.getFileExtension(this.url().getFileName()).toLowerCase(Locale.ROOT))) return this.url().toNormalform(true);// for pdf links we rewrite the url@@ -1041,7 +1038,7 @@ public class URIMetadataNode extends SolrDocument /* implements Comparable<URIMe}return this.toString(this.textSnippet.getLineRaw());}-+@Overridepublic int hashCode() {return this.url().hashCode();diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.javaindex dea2e023e..7696171fb 100644--- a/source/net/yacy/peers/Protocol.java+++ b/source/net/yacy/peers/Protocol.java@@ -871,9 +871,7 @@ public final class Protocol {return;}try {- long now = System.currentTimeMillis();- this.segment.setFirstSeenTime(entry.hash(), Math.min(entry.moddate().getTime(), now));- this.segment.setLoadTime(entry.hash(), now);+ this.segment.setFirstSeenTime(entry.hash(), Math.min(entry.moddate().getTime(), System.currentTimeMillis())); // Set only firstsee, but not load time - because we did not load the documentthis.segment.fulltext().putMetadata(entry); // it will be checked inside the putMetadata that poor metadata does not overwrite rich metadata} catch (final IOException e) {ConcurrentLog.logException(e);diff --git a/source/net/yacy/repository/LoaderDispatcher.java b/source/net/yacy/repository/LoaderDispatcher.javaindex cccec50c3..0fa5e537a 100644--- a/source/net/yacy/repository/LoaderDispatcher.java+++ b/source/net/yacy/repository/LoaderDispatcher.java@@ -155,7 +155,7 @@ public final class LoaderDispatcher {/*** loads a resource from cache or web/ftp/smb/file* on concurrent execution waits max 5 sec for the prev. loader to fill the cache (except for CacheStrategy.NOCACHE)- *+ ** @param request the request essentials* @param cacheStrategy strategy according to NOCACHE, IFFRESH, IFEXIST, CACHEONLY* @param maxFileSize@@ -207,13 +207,13 @@ public final class LoaderDispatcher {final String protocol = url.getProtocol();final String host = url.getHost();final CrawlProfile crawlProfile = request.profileHandle() == null ? null : this.sb.crawler.get(UTF8.getBytes(request.profileHandle()));-+// check if url is in blacklistif (blacklistType != null && host != null && Switchboard.urlBlacklist.isListed(blacklistType, host.toLowerCase(Locale.ROOT), url.getFile())) {this.sb.crawlQueues.errorURL.push(request.url(), request.depth(), crawlProfile, FailCategory.FINAL_LOAD_CONTEXT, "url in blacklist", -1);throw new IOException("DISPATCHER Rejecting URL '" + request.url().toString() + "'. URL is in blacklist.$");}-+// check if we have the page in the cacheResponse response = loadFromCache(request, cacheStrategy, agent, url, crawlProfile);if(response != null) {@@ -267,8 +267,8 @@ public final class LoaderDispatcher {final String storeError = response.shallStoreCacheForCrawler();if (storeError == null) {try {- /* Important : we associate here the loaded content with the URL response.url().- * On eventual redirection(s), response.url() provides the last redirection location.+ /* Important : we associate here the loaded content with the URL response.url().+ * On eventual redirection(s), response.url() provides the last redirection location.* If instead we associated content with the initial url (beginning of the redirection(s) chain),* the parsers would then have a wrong base URL when following links with relative URLs. */Cache.store(response.url(), response.getResponseHeader(), response.getContent());@@ -306,9 +306,9 @@ public final class LoaderDispatcher {// in case that we want to return the cached content in the next stepfinal RequestHeader requestHeader = new RequestHeader();requestHeader.put(HeaderFramework.USER_AGENT, agent.userAgent);- DigestURL refererURL = null;+ String refererURL = null;if (request.referrerhash() != null) refererURL = this.sb.getURL(request.referrerhash());- if (refererURL != null) requestHeader.put(RequestHeader.REFERER, refererURL.toNormalform(true));+ if (refererURL != null) requestHeader.put(RequestHeader.REFERER, refererURL);response = new Response(request,requestHeader,@@ -347,7 +347,7 @@ public final class LoaderDispatcher {}return response;}-+/*** Open an InputStream on a resource from the web, from ftp, from smb or a file* @param request the request essentials@@ -365,13 +365,13 @@ public final class LoaderDispatcher {final String protocol = url.getProtocol();final String host = url.getHost();final CrawlProfile crawlProfile = request.profileHandle() == null ? null : this.sb.crawler.get(UTF8.getBytes(request.profileHandle()));-+// check if url is in blacklistif (blacklistType != null && host != null && Switchboard.urlBlacklist.isListed(blacklistType, host.toLowerCase(Locale.ROOT), url.getFile())) {this.sb.crawlQueues.errorURL.push(request.url(), request.depth(), crawlProfile, FailCategory.FINAL_LOAD_CONTEXT, "url in blacklist", -1);throw new IOException("DISPATCHER Rejecting URL '" + request.url().toString() + "'. URL is in blacklist.$");}-+// check if we have the page in the cacheResponse cachedResponse = loadFromCache(request, cacheStrategy, agent, url, crawlProfile);if (cachedResponse != null) {@@ -412,7 +412,7 @@ public final class LoaderDispatcher {return response;}-+/*** Check access time: this is a double-check (we checked possibly already in the balancer)@@ -446,7 +446,7 @@ public final class LoaderDispatcher {/*** @param url the URL of a resource to load- * @return the crawler configured maximum size allowed to load for the protocol of the URL+ * @return the crawler configured maximum size allowed to load for the protocol of the URL*/public int protocolMaxFileSize(final DigestURL url) {if (url.isHTTP() || url.isHTTPS()) {@@ -480,7 +480,7 @@ public final class LoaderDispatcher {// read resource body (if it is there)return entry.getContent();}-+/*** Open the URL as an InputStream from the web or the cache* @param request must be not null@@ -527,7 +527,7 @@ public final class LoaderDispatcher {return response;}-+/*** Open the URL as an InputStream from the web or the cache. Apply the default per protocol configured maximum file size limit.* @param request must be not null@@ -560,7 +560,7 @@ public final class LoaderDispatcher {if (x_robots_tag.indexOf("noindex",0) >= 0) {for (Document d: documents) d.setIndexingDenied(true);}-+return documents;}@@ -578,16 +578,16 @@ public final class LoaderDispatcher {try {Document[] documents = response.parse();Document merged = Document.mergeDocuments(location, response.getMimeType(), documents);-+String x_robots_tag = response.getResponseHeader().getXRobotsTag();if (x_robots_tag.indexOf("noindex",0) >= 0) merged.setIndexingDenied(true);-+return merged;} catch(final Parser.Failure e) {throw new IOException(e.getMessage());}}-+/*** Similar to the loadDocument method, but streaming the resource content when possible instead of fully loading it in memory.* @param location URL of the resource to load@@ -597,7 +597,7 @@ public final class LoaderDispatcher {* @return on parsed document or null when an error occurred while parsing* @throws IOException when the content can not be fetched or no parser support it*/- public Document loadDocumentAsStream(final DigestURL location, final CacheStrategy cachePolicy,+ public Document loadDocumentAsStream(final DigestURL location, final CacheStrategy cachePolicy,final BlacklistType blacklistType, final ClientIdentification.Agent agent) throws IOException {// load resourceRequest request = request(location, true, false);@@ -615,18 +615,18 @@ public final class LoaderDispatcher {try {Document[] documents = streamResponse.parse();Document merged = Document.mergeDocuments(location, response.getMimeType(), documents);-+String x_robots_tag = response.getResponseHeader().getXRobotsTag();if (x_robots_tag.indexOf("noindex",0) >= 0) {merged.setIndexingDenied(true);}-+return merged;} catch(final Parser.Failure e) {throw new IOException(e.getMessage());}}-+/*** Similar to the loadDocument method, but streaming the resource content* when possible instead of fully loading it in memory.<br>@@ -638,7 +638,7 @@ public final class LoaderDispatcher {* {@link Parser#isParseWithLimitsSupported()}. When available parsers do* not support parsing within limits, an exception is thrown when* content size is beyond maxBytes.- *+ ** @param location* URL of the resource to load* @param cachePolicy@@ -656,7 +656,7 @@ public final class LoaderDispatcher {* @throws IOException* when the content can not be fetched or no parser support it*/- public Document loadDocumentAsLimitedStream(final DigestURL location, final CacheStrategy cachePolicy,+ public Document loadDocumentAsLimitedStream(final DigestURL location, final CacheStrategy cachePolicy,final BlacklistType blacklistType, final ClientIdentification.Agent agent, final int maxLinks, final long maxBytes) throws IOException {// load resourceRequest request = request(location, true, false);@@ -674,12 +674,12 @@ public final class LoaderDispatcher {try {Document[] documents = streamResponse.parseWithLimits(maxLinks, maxBytes);Document merged = Document.mergeDocuments(location, response.getMimeType(), documents);-+String x_robots_tag = response.getResponseHeader().getXRobotsTag();if (x_robots_tag.indexOf("noindex",0) >= 0) {merged.setIndexingDenied(true);}-+return merged;} catch(final Parser.Failure e) {throw new IOException(e.getMessage());diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.javaindex 3de654bcf..3cea8164e 100644--- a/source/net/yacy/search/Switchboard.java+++ b/source/net/yacy/search/Switchboard.java@@ -1921,12 +1921,20 @@ public final class Switchboard extends serverSwitch {this.crawlQueues.removeURL(hash);}- public DigestURL getURL(final byte[] urlhash) throws IOException {+ public String getURL(final byte[] urlhash) throws IOException {if (urlhash == null) return null;if (urlhash.length == 0) return null;- final DigestURL url = this.index.fulltext().getURL(ASCII.String(urlhash));+ final String url = this.index.fulltext().getURL(ASCII.String(urlhash));if (url != null) return url;- return this.crawlQueues.getURL(urlhash);+ return this.crawlQueues.getURL(urlhash).toNormalform(true);+ }++ public String getURL(final String urlhash) throws IOException {+ if (urlhash == null) return null;+ if (urlhash.length() == 0) return null;+ final String url = this.index.fulltext().getURL(urlhash);+ if (url != null) return url;+ return this.crawlQueues.getURL(urlhash.getBytes()).toNormalform(true);}public RankingProfile getRanking() {diff --git a/source/net/yacy/search/index/Fulltext.java b/source/net/yacy/search/index/Fulltext.javaindex 5578d5bfa..75a399557 100644--- a/source/net/yacy/search/index/Fulltext.java+++ b/source/net/yacy/search/index/Fulltext.java@@ -400,25 +400,17 @@ public final class Fulltext {String id = ASCII.String(idb);try {// because node entries are richer than metadata entries we must check if they exist to prevent that they are overwritten- long date = this.getLoadTime(id);- if (date == -1) {+ SolrDocument doc = this.getDefaultConnector().getDocumentById(id, CollectionSchema.collection_sxt.getSolrFieldName());+ if (doc == null || !doc.containsKey(CollectionSchema.collection_sxt.getSolrFieldName())) {// document does not existputDocument(getDefaultConfiguration().metadata2solr(entry));} else {- // check if document contains rich data- if (date < entry.loaddate().getTime()) {- SolrDocument doc = this.getDefaultConnector().getDocumentById(id, CollectionSchema.collection_sxt.getSolrFieldName());- if (doc == null || !doc.containsKey(CollectionSchema.collection_sxt.getSolrFieldName())) {- putDocument(getDefaultConfiguration().metadata2solr(entry));- } else {- Collection<Object> collections = doc.getFieldValues(CollectionSchema.collection_sxt.getSolrFieldName());- // collection dht is used to identify metadata from full crawled documents (if "dht" exists don't overwrite rich crawldata with metadata- if (!collections.contains("dht")) return;+ Collection<Object> collections = doc.getFieldValues(CollectionSchema.collection_sxt.getSolrFieldName());+ // collection dht is used to identify metadata from full crawled documents (if "dht" exists don't overwrite rich crawldata with metadata+ if (!collections.contains("dht")) return;- // passed all checks, overwrite document- putDocument(getDefaultConfiguration().metadata2solr(entry));- }- }+ // passed all checks, overwrite document+ putDocument(getDefaultConfiguration().metadata2solr(entry));}} catch (final SolrException e) {throw new IOException(e.getMessage(), e);@@ -565,12 +557,10 @@ public final class Fulltext {return false;}- public DigestURL getURL(final String urlHash) throws IOException {+ public String getURL(final String urlHash) throws IOException {if (urlHash == null || this.getDefaultConnector() == null) return null;- SolrConnector.LoadTimeURL md = this.getDefaultConnector().getLoadTimeURL(urlHash);- if (md == null) return null;- return new DigestURL(md.url, ASCII.getBytes(urlHash));+ return this.getDefaultConnector().getURL(urlHash);}/**@@ -582,19 +572,6 @@ public final class Fulltext {return this.getDefaultConnector().exists(id);}- /**- * get the load time of a resource.- * @param urlHash- * @return the time in milliseconds since epoch for the load time or -1 if the document does not exist- */- @Deprecated- private long getLoadTime(final String urlHash) throws IOException {- if (urlHash == null) return -1l;- SolrConnector.LoadTimeURL md = this.getDefaultConnector().getLoadTimeURL(urlHash);- if (md == null) return -1l;- return md.date;- }-public List<File> dumpFiles() {EmbeddedInstance esc = this.solrInstances.getEmbedded();ArrayList<File> zips = new ArrayList<File>();diff --git a/source/net/yacy/search/index/Segment.java b/source/net/yacy/search/index/Segment.javaindex 953a7379f..7333f463a 100644--- a/source/net/yacy/search/index/Segment.java+++ b/source/net/yacy/search/index/Segment.java@@ -51,7 +51,6 @@ import net.yacy.cora.document.id.DigestURL;import net.yacy.cora.document.id.MultiProtocolURL;import net.yacy.cora.federate.solr.connector.AbstractSolrConnector;import net.yacy.cora.federate.solr.connector.SolrConnector;-import net.yacy.cora.federate.solr.connector.SolrConnector.LoadTimeURL;import net.yacy.cora.federate.yacy.CacheStrategy;import net.yacy.cora.order.Base64Order;import net.yacy.cora.order.ByteOrder;@@ -425,16 +424,6 @@ public class Segment {}}- public LoadTimeURL getLoadTimeURL(String url, byte[] urlhash) {- long t = getLoadTime(urlhash);- if (t < 0) return null;- return new LoadTimeURL(url, t);- }-- public LoadTimeURL getLoadTimeURL(String url, String id) {- return getLoadTimeURL(url, id.getBytes());- }-/*** check if a given document, identified by url hash as document id exists* @param id the url hash and document id@@ -843,7 +832,8 @@ public class Segment {if (urlhash == null) return 0;// determine the url stringtry {- final DigestURL url = fulltext().getURL(ASCII.String(urlhash));+ final String u = fulltext().getURL(ASCII.String(urlhash));+ final DigestURL url = u == null ? null : new DigestURL(u);if (url == null) return 0;// parse the resourcediff --git a/source/net/yacy/search/schema/CollectionConfiguration.java b/source/net/yacy/search/schema/CollectionConfiguration.javaindex 6dca8d889..9609ecfe8 100644--- a/source/net/yacy/search/schema/CollectionConfiguration.java+++ b/source/net/yacy/search/schema/CollectionConfiguration.java@@ -69,7 +69,6 @@ import net.yacy.cora.federate.solr.SchemaConfiguration;import net.yacy.cora.federate.solr.SchemaDeclaration;import net.yacy.cora.federate.solr.connector.AbstractSolrConnector;import net.yacy.cora.federate.solr.connector.SolrConnector;-import net.yacy.cora.federate.solr.connector.SolrConnector.LoadTimeURL;import net.yacy.cora.federate.solr.logic.BooleanLiteral;import net.yacy.cora.federate.solr.logic.CatchallLiteral;import net.yacy.cora.federate.solr.logic.Conjunction;@@ -2030,8 +2029,8 @@ public class CollectionConfiguration extends SchemaConfiguration implements Serifor (final Map.Entry<byte[], CRV> entry: rm.entrySet()) {if (entry == null || entry.getValue() == null) continue;try {- final LoadTimeURL md = connector.getLoadTimeURL(ASCII.String(entry.getKey()));- ConcurrentLog.info("CollectionConfiguration", "CR for " + md.url);+ final String url = connector.getURL(ASCII.String(entry.getKey()));+ ConcurrentLog.info("CollectionConfiguration", "CR for " + url);ConcurrentLog.info("CollectionConfiguration", ">> " + entry.getValue().toString());} catch (final IOException e) {ConcurrentLog.logException(e);