use of com.yahoo.prelude.query.textualrepresentation.TextualQueryRepresentation in project vespa by vespa-engine.
the class VespaBackEndSearcher method traceQuery.
static void traceQuery(String sourceName, String type, Query query, int offset, int hits, int level, Optional<String> quotedSummaryClass) {
if ((query.getTraceLevel() < level) || query.properties().getBoolean(TRACE_DISABLE))
return;
StringBuilder s = new StringBuilder();
s.append(sourceName).append(" " + type + " to dispatch: ").append("query=[").append(query.getModel().getQueryTree().getRoot().toString()).append("]");
s.append(" timeout=").append(query.getTimeout()).append("ms");
s.append(" offset=").append(offset).append(" hits=").append(hits);
if (query.getRanking().hasRankProfile()) {
s.append(" rankprofile[").append(query.getRanking().getProfile()).append("]");
}
if (query.getRanking().getFreshness() != null) {
s.append(" freshness=").append(query.getRanking().getFreshness().getRefTime());
}
if (query.getRanking().getSorting() != null) {
s.append(" sortspec=").append(query.getRanking().getSorting().fieldOrders().toString());
}
if (query.getRanking().getLocation() != null) {
s.append(" location=").append(query.getRanking().getLocation().toString());
}
if (query.getGroupingSessionCache()) {
s.append(" groupingSessionCache=true");
}
if (query.getRanking().getQueryCache()) {
s.append(" ranking.queryCache=true");
}
if (query.getGroupingSessionCache() || query.getRanking().getQueryCache()) {
s.append(" sessionId=").append(query.getSessionId(true));
}
List<Grouping> grouping = GroupingExecutor.getGroupingList(query);
s.append(" grouping=").append(grouping.size()).append(" : ");
for (Grouping g : grouping) {
s.append(g.toString());
}
if (!query.getRanking().getProperties().isEmpty()) {
s.append(" rankproperties=").append(query.getRanking().getProperties().toString());
}
if (!query.getRanking().getFeatures().isEmpty()) {
s.append(" rankfeatures=").append(query.getRanking().getFeatures().toString());
}
if (query.getModel().getRestrict() != null) {
s.append(" restrict=").append(query.getModel().getRestrict().toString());
}
if (quotedSummaryClass.isPresent()) {
s.append(" summary=").append(quotedSummaryClass.get());
}
query.trace(s.toString(), false, level);
if (query.isTraceable(level + 1)) {
query.trace("Current state of query tree: " + new TextualQueryRepresentation(query.getModel().getQueryTree().getRoot()), false, level + 1);
}
if (query.isTraceable(level + 2)) {
query.trace("YQL+ representation: " + query.yqlRepresentation(), level + 2);
}
}
Aggregations