From 4a9182ae16bf9c222c702398857077ad23e038e1 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Thu, 27 Dec 2012 03:19:21 +0100 Subject: [PATCH] use the search configuration to default the cacheStrategy to the value as given in the search configuration --- htroot/yacysearch.java | 4 +--- source/net/yacy/cora/federate/yacy/CacheStrategy.java | 2 +- source/net/yacy/search/query/QueryGoal.java | 5 ++++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index fdbbb0354..3b02586fb 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -40,7 +40,6 @@ import java.util.TreeSet; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import net.yacy.cora.document.ASCII; import net.yacy.cora.document.analysis.Classification; import net.yacy.cora.document.analysis.Classification.ContentDomain; import net.yacy.cora.document.RSSMessage; @@ -61,7 +60,6 @@ import net.yacy.document.LibraryProvider; import net.yacy.document.Parser; import net.yacy.kelondro.data.meta.DigestURI; import net.yacy.kelondro.data.meta.URIMetadataNode; -import net.yacy.kelondro.data.word.Word; import net.yacy.kelondro.logging.Log; import net.yacy.kelondro.util.Bitfield; import net.yacy.kelondro.util.Formatter; @@ -116,7 +114,7 @@ public class yacysearch { // get query final String originalquerystring = (post == null) ? "" : post.get("query", post.get("search", "")).trim(); String querystring = originalquerystring.replace('+', ' ').trim(); - CacheStrategy snippetFetchStrategy = (post == null) ? null : CacheStrategy.parse(post.get("verify", "cacheonly")); + CacheStrategy snippetFetchStrategy = (post == null) ? null : CacheStrategy.parse(post.get("verify", sb.getConfig("search.verify", ""))); if (authenticated && originalquerystring.length() == 0) sb.index.fulltext().commit(); final servletProperties prop = new servletProperties(); diff --git a/source/net/yacy/cora/federate/yacy/CacheStrategy.java b/source/net/yacy/cora/federate/yacy/CacheStrategy.java index 35618ebfe..5b43a9dd5 100644 --- a/source/net/yacy/cora/federate/yacy/CacheStrategy.java +++ b/source/net/yacy/cora/federate/yacy/CacheStrategy.java @@ -66,7 +66,7 @@ public enum CacheStrategy { } public static CacheStrategy parse(final String name) { - if (name == null) return null; + if (name == null || name.length() == 0) return null; if (name.equals("nocache")) return NOCACHE; if (name.equals("iffresh")) return IFFRESH; if (name.equals("ifexist")) return IFEXIST; diff --git a/source/net/yacy/search/query/QueryGoal.java b/source/net/yacy/search/query/QueryGoal.java index 74e3a9ab6..edc745b87 100644 --- a/source/net/yacy/search/query/QueryGoal.java +++ b/source/net/yacy/search/query/QueryGoal.java @@ -24,6 +24,7 @@ package net.yacy.search.query; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; +import java.util.Map; import java.util.SortedSet; import net.yacy.cora.federate.solr.Boost; @@ -229,7 +230,9 @@ public class QueryGoal { // combine these queries for all relevant fields wc = 0; Float boost; - for (YaCySchema field: Boost.GOAL_FIELDS) { + for (Map.Entry entry: Boost.RANKING.entrySet()) { + YaCySchema field = entry.getKey(); + if (entry.getValue().floatValue() < 0.0f) continue; if (configuration != null && !configuration.contains(field.getSolrFieldName())) continue; if (wc > 0) q.append(" OR "); q.append('(');