diff options
author | Geir Storli <geirst@yahooinc.com> | 2023-01-20 16:50:50 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2023-01-20 16:50:50 +0000 |
commit | ea7f8d4d792c122ef9b603deebdc69000026cb72 (patch) | |
tree | 42c1937e1b1460650091091afa244ec773aad024 /container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java | |
parent | f01c1607b1637eecb40a45c32b851ebeec539fe7 (diff) |
Add query trace parameters for profiling backend query evaluation.
With this change, profiling of matching, first-phase ranking, and second-phase ranking
can be tuned separately.
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java index e4a83972fae..da0051c527c 100644 --- a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java +++ b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java @@ -16,6 +16,8 @@ import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry; import com.yahoo.search.query.profile.types.ConversionContext; import com.yahoo.search.query.profile.types.FieldDescription; import com.yahoo.search.query.profile.types.QueryProfileType; +import com.yahoo.search.query.profiling.Profiling; +import com.yahoo.search.query.profiling.ProfilingParams; import com.yahoo.search.query.ranking.Diversity; import com.yahoo.search.query.ranking.MatchPhase; import com.yahoo.search.query.ranking.Matching; @@ -322,6 +324,15 @@ public class QueryProperties extends Properties { if (key.last().equals(Trace.QUERY)) query.getTrace().setQuery(asBoolean(value, true)); } + else if ((key.size() == 4) && + key.get(0).equals(Trace.TRACE) && + key.get(1).equals(Trace.PROFILING) && + key.get(3).equals(ProfilingParams.DEPTH)) { + var params = getProfilingParams(query.getTrace().getProfiling(), key.get(2)); + if (params != null) { + params.setDepth(asInteger(value, 0)); + } + } else if (key.first().equals(Select.SELECT)) { if (key.size() == 1) { query.getSelect().setGroupingExpressionString(asString(value, "")); @@ -364,6 +375,17 @@ public class QueryProperties extends Properties { } } + private static ProfilingParams getProfilingParams(Profiling prof, String name) { + if (name.equals(Profiling.MATCHING)) { + return prof.getMatching(); + } else if (name.equals(Profiling.FIRST_PHASE_RANKING)) { + return prof.getFirstPhaseRanking(); + } else if (name.equals(Profiling.SECOND_PHASE_RANKING)) { + return prof.getSecondPhaseRanking(); + } + return null; + } + @Override public Map<String, Object> listProperties(CompoundName prefix, Map<String,String> context, |