Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
in method exists() also use the new caching-stacks for documents/metadata
Michael Peter Christen2b6c79d3470e
diff --git a/source/net/yacy/kelondro/data/meta/URIMetadataNode.java b/source/net/yacy/kelondro/data/meta/URIMetadataNode.javaindex c9f809225..27b0ca243 100644--- a/source/net/yacy/kelondro/data/meta/URIMetadataNode.java+++ b/source/net/yacy/kelondro/data/meta/URIMetadataNode.java@@ -46,9 +46,7 @@ import net.yacy.kelondro.util.Bitfield;import net.yacy.search.schema.CollectionSchema;import net.yacy.utils.crypt;-import org.apache.solr.client.solrj.util.ClientUtils;import org.apache.solr.common.SolrDocument;-import org.apache.solr.common.SolrInputDocument;/**diff --git a/source/net/yacy/search/index/Fulltext.java b/source/net/yacy/search/index/Fulltext.javaindex b1079fae6..b63645817 100644--- a/source/net/yacy/search/index/Fulltext.java+++ b/source/net/yacy/search/index/Fulltext.java@@ -306,6 +306,24 @@ public final class Fulltext {public DigestURI getURL(final byte[] urlHash) {if (urlHash == null) return null;++ // try to get the data from the delayed cache; this happens if we retrieve this from a fresh search result+ String u = ASCII.String(urlHash);+ for (URIMetadataRow entry: this.pendingCollectionInputRows) {+ if (u.equals(ASCII.String(entry.hash()))) {+ if (this.urlIndexFile != null) try {this.urlIndexFile.remove(urlHash);} catch (IOException e) {} // migration+ return entry.url();+ }+ }++ for (SolrInputDocument doc: this.pendingCollectionInputDocuments) {+ if (u.equals(doc.getFieldValue(CollectionSchema.id.getSolrFieldName()))) {+ if (this.urlIndexFile != null) try {this.urlIndexFile.remove(urlHash);} catch (IOException e) {} // migration+ String url = (String) doc.getFieldValue(CollectionSchema.sku.getSolrFieldName());+ if (url != null) try {return new DigestURI(url);} catch (MalformedURLException e) {}+ }+ }+String x;try {x = (String) this.getDefaultConnector().getFieldById(ASCII.String(urlHash), CollectionSchema.sku.getSolrFieldName());@@ -340,8 +358,7 @@ public final class Fulltext {// try to get the data from the delayed cache; this happens if we retrieve this from a fresh search resultfor (URIMetadataRow entry: this.pendingCollectionInputRows) {- String id = ASCII.String(entry.hash());- if (id != null && id.equals(u)) {+ if (u.equals(ASCII.String(entry.hash()))) {if (this.urlIndexFile != null) try {this.urlIndexFile.remove(urlHash);} catch (IOException e) {} // migrationSolrDocument sd = this.collectionConfiguration.toSolrDocument(getDefaultConfiguration().metadata2solr(entry));return new URIMetadataNode(sd, wre, weight);@@ -349,8 +366,7 @@ public final class Fulltext {}for (SolrInputDocument doc: this.pendingCollectionInputDocuments) {- String id = (String) doc.getFieldValue(CollectionSchema.id.getSolrFieldName());- if (id != null && id.equals(u)) {+ if (u.equals(doc.getFieldValue(CollectionSchema.id.getSolrFieldName()))) {if (this.urlIndexFile != null) try {this.urlIndexFile.remove(urlHash);} catch (IOException e) {} // migrationSolrDocument sd = this.collectionConfiguration.toSolrDocument(doc);return new URIMetadataNode(sd, wre, weight);@@ -709,12 +725,18 @@ public final class Fulltext {public boolean exists(final String urlHash) {if (urlHash == null) return false;- if (this.urlIndexFile != null && this.urlIndexFile.has(ASCII.getBytes(urlHash))) return true;+ for (URIMetadataRow entry: this.pendingCollectionInputRows) {+ if (urlHash.equals(ASCII.String(entry.hash()))) return true;+ }+ for (SolrInputDocument doc: this.pendingCollectionInputDocuments) {+ if (urlHash.equals(doc.getFieldValue(CollectionSchema.id.getSolrFieldName()))) return true;+ }try {if (this.getDefaultConnector().exists(CollectionSchema.id.getSolrFieldName(), urlHash)) return true;} catch (final Throwable e) {Log.logException(e);}+ if (this.urlIndexFile != null && this.urlIndexFile.has(ASCII.getBytes(urlHash))) return true;return false;}