Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.handler.component;
import static org.apache.solr.common.params.CommonParams.FQ;
import static org.apache.solr.common.params.CommonParams.JSON;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import org.apache.lucene.search.Query;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.search.DocList;
import org.apache.solr.search.QueryParsing;
import org.apache.solr.search.SolrIndexSearcher;
import org.apache.solr.search.facet.FacetDebugInfo;
import org.apache.solr.search.stats.StatsCache;
import org.apache.solr.util.SolrPluginUtils;
import org.apache.solr.util.SolrResponseUtil;
/**
* Adds debugging information to a request.
*
* @since solr 1.3
*/
public class DebugComponent extends SearchComponent {
public static final String COMPONENT_NAME = "debug";
/**
* Map containing all the possible stages as key and the corresponding readable purpose as value
*/
private static final Map stages;
static {
Map map = new TreeMap<>();
map.put(ResponseBuilder.STAGE_START, "START");
map.put(ResponseBuilder.STAGE_PARSE_QUERY, "PARSE_QUERY");
map.put(ResponseBuilder.STAGE_TOP_GROUPS, "TOP_GROUPS");
map.put(ResponseBuilder.STAGE_EXECUTE_QUERY, "EXECUTE_QUERY");
map.put(ResponseBuilder.STAGE_GET_FIELDS, "GET_FIELDS");
map.put(ResponseBuilder.STAGE_DONE, "DONE");
stages = Collections.unmodifiableMap(map);
}
@Override
public void prepare(ResponseBuilder rb) throws IOException {
if (rb.isDebugTrack() && rb.isDistrib) {
rb.setNeedDocList(true);
doDebugTrack(rb);
}
}
@Override
public void process(ResponseBuilder rb) throws IOException {
if (rb.isDebug()) {
SolrQueryRequest req = rb.req;
StatsCache statsCache = req.getSearcher().getStatsCache();
req.getContext().put(SolrIndexSearcher.STATS_SOURCE, statsCache.get(req));
DocList results = null;
// some internal grouping requests won't have results value set
if (rb.getResults() != null) {
results = rb.getResults().docList;
}
NamedList