aboutsummaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-10-25 10:09:06 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-10-25 10:09:06 +0200
commite5b9d236fedda0854fb33a5af0f02a3d6dbeabdf (patch)
treee0d125830460f4ac0e2cba752f442302794043b1 /container-search
parent2ee87c18e47fd10392440f64aec12a00f52b8376 (diff)
parent4be382d5cf1c0e17b3e5e014ad7b1b45a70ca5ba (diff)
Merge with master
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java41
1 files changed, 20 insertions, 21 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java b/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java
index 36ae057b418..2f431b7799e 100644
--- a/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java
+++ b/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java
@@ -341,10 +341,10 @@ public class ClusterSearcher extends Searcher {
if (invalidInDocTypes != null && !invalidInDocTypes.isEmpty()) {
String plural = invalidInDocTypes.size() > 1 ? "s" : "";
- return new Result(query, ErrorMessage.createInvalidQueryParameter(
- "Requested rank profile '" + rankProfile +
- "' is undefined for document type" + plural + " '" +
- StringUtils.join(invalidInDocTypes.iterator(), ", ") + "'"));
+ return new Result(query,
+ ErrorMessage.createInvalidQueryParameter("Requested rank profile '" + rankProfile +
+ "' is undefined for document type" + plural + " '" +
+ StringUtils.join(invalidInDocTypes.iterator(), ", ") + "'"));
}
return null;
@@ -373,9 +373,7 @@ public class ClusterSearcher extends Searcher {
}
}
// no error: good result, let's return
- if (result.hits().getError() == null) {
- return;
- }
+ if (result.hits().getError() == null) return;
} while (tries < hasher.getNodeCount() && failoverToRemote);
}
@@ -387,11 +385,8 @@ public class ClusterSearcher extends Searcher {
private void updateCacheHitRatio(Result result, Query query) {
// result.isCached() looks at the contained hits, so if there are no
- // hits, the result will be treated as cached, even though the backend
- // was queried.
- if (result.hits().getError() == null
- && result.hits().getConcreteSize() > 0) {
-
+ // hits, the result will be treated as cached, even though the backend was queried.
+ if (result.hits().getError() == null && result.hits().getConcreteSize() > 0) {
if (result.isCached()) {
cacheHit();
} else if (!query.getNoCache()) {
@@ -401,7 +396,7 @@ public class ClusterSearcher extends Searcher {
}
@Override
- public Result search(com.yahoo.search.Query query, Execution execution) {
+ public Result search(Query query, Execution execution) {
Result result;
int tries = 0;
@@ -436,19 +431,23 @@ public class ClusterSearcher extends Searcher {
}
private void validateQueryTimeout(Query query) {
- if (query.getTimeout() > maxQueryTimeout) {
- log.warning("Query timeout (" + query.getTimeout() + " ms) > max query timeout (" + maxQueryTimeout + " ms) for '" +
- query.toString() + "'. Setting timeout to " + maxQueryTimeout + " ms.");
- query.setTimeout(maxQueryTimeout);
+ if (query.getTimeout() <= maxQueryTimeout) return;
+
+ if (query.isTraceable(2)) {
+ query.trace("Query timeout (" + query.getTimeout() + " ms) > max query timeout (" +
+ maxQueryTimeout + " ms). Setting timeout to " + maxQueryTimeout + " ms.", 2);
}
+ query.setTimeout(maxQueryTimeout);
}
private void validateQueryCache(Query query) {
- if (query.getRanking().getQueryCache() && query.getTimeout() > maxQueryCacheTimeout) {
- log.warning("Query timeout (" + query.getTimeout() + " ms) > max query cache timeout (" + maxQueryCacheTimeout + " ms) for '" +
- query.toString() + "'. Disabling query cache.");
- query.getRanking().setQueryCache(false);
+ if (query.getRanking().getQueryCache() && query.getTimeout() <= maxQueryCacheTimeout) return;
+
+ if (query.isTraceable(2)) {
+ query.trace("Query timeout (" + query.getTimeout() + " ms) > max query cache timeout (" +
+ maxQueryCacheTimeout + " ms). Disabling query cache.", 2);
}
+ query.getRanking().setQueryCache(false);
}
private Result doSearch(Searcher searcher, Query query, Execution execution) {