From 5d16c23a1f4775fef912a6c5eab197671e49eb31 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Tue, 16 Oct 2012 18:26:21 +0200 Subject: [PATCH] specified more URIMetadata as URIMetadataNode --- htroot/IndexControlRWIs_p.java | 2 +- source/net/yacy/search/index/DocumentIndex.java | 3 ++- source/net/yacy/search/query/RWIProcess.java | 3 +-- source/net/yacy/search/query/SnippetProcess.java | 16 +++------------- source/net/yacy/search/snippet/ResultEntry.java | 6 +++--- source/net/yacy/search/snippet/TextSnippet.java | 3 ++- 6 files changed, 12 insertions(+), 21 deletions(-) diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.java index 82dc081a3..c7e1f6af2 100644 --- a/htroot/IndexControlRWIs_p.java +++ b/htroot/IndexControlRWIs_p.java @@ -475,7 +475,7 @@ public class IndexControlRWIs_p { prop.put("genUrlList_lines", maxlines); int i = 0; DigestURI url; - URIMetadata entry; + URIMetadataNode entry; String us; long rn = -1; while ( !ranked.isEmpty() && (entry = ranked.takeURL(false, 1000)) != null ) { diff --git a/source/net/yacy/search/index/DocumentIndex.java b/source/net/yacy/search/index/DocumentIndex.java index 5d9c6b033..c7539e59e 100644 --- a/source/net/yacy/search/index/DocumentIndex.java +++ b/source/net/yacy/search/index/DocumentIndex.java @@ -42,6 +42,7 @@ import net.yacy.document.LibraryProvider; import net.yacy.document.TextParser; import net.yacy.kelondro.data.meta.DigestURI; import net.yacy.kelondro.data.meta.URIMetadata; +import net.yacy.kelondro.data.meta.URIMetadataNode; import net.yacy.kelondro.logging.Log; import net.yacy.search.query.QueryParams; import net.yacy.search.query.RWIProcess; @@ -236,7 +237,7 @@ public class DocumentIndex extends Segment { rankedCache.start(); // search is running; retrieve results - URIMetadata row; + URIMetadataNode row; final ArrayList files = new ArrayList(); while ( (row = rankedCache.takeURL(false, 1000)) != null ) { files.add(row.url()); diff --git a/source/net/yacy/search/query/RWIProcess.java b/source/net/yacy/search/query/RWIProcess.java index 23c954031..1c31a56d8 100644 --- a/source/net/yacy/search/query/RWIProcess.java +++ b/source/net/yacy/search/query/RWIProcess.java @@ -58,7 +58,6 @@ import net.yacy.document.Condenser; import net.yacy.document.LibraryProvider; import net.yacy.interaction.contentcontrol.ContentControlFilterUpdateThread; import net.yacy.kelondro.data.meta.DigestURI; -import net.yacy.kelondro.data.meta.URIMetadata; import net.yacy.kelondro.data.meta.URIMetadataNode; import net.yacy.kelondro.data.meta.URIMetadataRow; import net.yacy.kelondro.data.word.Word; @@ -625,7 +624,7 @@ public final class RWIProcess extends Thread * @param waitingtime the time this method may take for a result computation * @return a metadata entry for a url */ - public URIMetadata takeURL(final boolean skipDoubleDom, final long waitingtime) { + public URIMetadataNode takeURL(final boolean skipDoubleDom, final long waitingtime) { // returns from the current RWI list the best URL entry and removes this entry from the list final long timeout = System.currentTimeMillis() + Math.max(10, waitingtime); int p = -1; diff --git a/source/net/yacy/search/query/SnippetProcess.java b/source/net/yacy/search/query/SnippetProcess.java index 5e5f625d0..8dba682fe 100644 --- a/source/net/yacy/search/query/SnippetProcess.java +++ b/source/net/yacy/search/query/SnippetProcess.java @@ -26,7 +26,6 @@ package net.yacy.search.query; -import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -456,7 +455,7 @@ public class SnippetProcess { public void run() { // start fetching urls and snippets - URIMetadata page; + URIMetadataNode page; ResultEntry resultEntry; //final int fetchAhead = snippetMode == 0 ? 0 : 10; final boolean nav_topics = SnippetProcess.this.query.navigators.equals("all") || SnippetProcess.this.query.navigators.indexOf("topics",0) >= 0; @@ -498,16 +497,7 @@ public class SnippetProcess { // in case that we have an attached solr, we load also the solr document String solrContent = null; - SolrDocument sd = null; - if (page instanceof URIMetadataNode) { - sd = ((URIMetadataNode) page).getDocument(); - } else { - try { - sd = this.metadata.getSolr().get(ASCII.String(page.hash())); - } catch (IOException e) { - Log.logException(e); - } - } + SolrDocument sd = page.getDocument(); if (sd != null) { solrContent = this.metadata.getSolrScheme().solrGetText(sd); } @@ -556,7 +546,7 @@ public class SnippetProcess { } } - protected ResultEntry fetchSnippet(final URIMetadata page, final String solrText, final CacheStrategy cacheStrategy) { + protected ResultEntry fetchSnippet(final URIMetadataNode page, final String solrText, final CacheStrategy cacheStrategy) { // Snippet Fetching can has 3 modes: // 0 - do not fetch snippets // 1 - fetch snippets offline only diff --git a/source/net/yacy/search/snippet/ResultEntry.java b/source/net/yacy/search/snippet/ResultEntry.java index 4fa6767e3..5485faa60 100644 --- a/source/net/yacy/search/snippet/ResultEntry.java +++ b/source/net/yacy/search/snippet/ResultEntry.java @@ -35,7 +35,7 @@ import net.yacy.cora.document.MultiProtocolURI; import net.yacy.cora.order.Base64Order; import net.yacy.document.Condenser; import net.yacy.kelondro.data.meta.DigestURI; -import net.yacy.kelondro.data.meta.URIMetadata; +import net.yacy.kelondro.data.meta.URIMetadataNode; import net.yacy.kelondro.data.word.Word; import net.yacy.kelondro.data.word.WordReference; import net.yacy.kelondro.data.word.WordReferenceRow; @@ -52,7 +52,7 @@ import net.yacy.search.index.Segment; public class ResultEntry implements Comparable, Comparator { // payload objects - private final URIMetadata urlentry; + private final URIMetadataNode urlentry; private String alternative_urlstring; private String alternative_urlname; private final TextSnippet textSnippet; @@ -62,7 +62,7 @@ public class ResultEntry implements Comparable, Comparator, Comparator