diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-06-14 15:41:08 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-06-14 15:41:08 +0200 |
commit | 2788e1e0530c2d54d513ac460f919405a58657d6 (patch) | |
tree | b174c89bedb94e321e5516d892844e8e6ec79ca4 /container-search/src/main/java/com/yahoo/search/Query.java | |
parent | 8d8b96b3620f4de369bed60a9c19b6a5fc8b0e95 (diff) |
Turn tracing of the query on/off by trace.query=true/false
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/Query.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/Query.java | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/Query.java b/container-search/src/main/java/com/yahoo/search/Query.java index e4f62f83e99..131fe8d151a 100644 --- a/container-search/src/main/java/com/yahoo/search/Query.java +++ b/container-search/src/main/java/com/yahoo/search/Query.java @@ -692,32 +692,23 @@ public class Query extends com.yahoo.processing.Request implements Cloneable { * by an IllegalStateException. In other words, intended use is create the * new query, and attach the context to the invoking query as soon as the new * query is properly initialized. - * * <p> * This method will always set the argument query's context level to the context * level of this query. * - * @param query - * The query which should be traced as a part of this query. - * @throws IllegalStateException - * If the query given as argument already has context - * information. + * @param query the query which should be traced as a part of this query + * @throws IllegalStateException if the query given as argument already has context information */ public void attachContext(Query query) throws IllegalStateException { - query.setTraceLevel(getTraceLevel()); + query.getTrace().setLevel(getTrace().getLevel()); query.setExplainLevel(getExplainLevel()); - if (context == null) { - // Nothing to attach to. This is about the same as - // getTraceLevel() == 0, - // but is a direct test of what will make the function superfluous. - return; - } + if (context == null) return; if (query.getContext(false) != null) { // If we added the other query's context info as a subnode in this // query's context tree, we would have to check for loops in the // context graph. If we simply created a new node without checking, // we might silently overwrite useful information. - throw new IllegalStateException("Query to attach already has context information stored."); + throw new IllegalStateException("Query to attach already has context information stored"); } query.context = context; } |