You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2018/11/09 04:33:56 UTC
lucene-solr:branch_7x: SOLR-12880: Show the FacetProcessor class name
instead of the FacetRequest in the JSON Facets debug-trace output
Repository: lucene-solr
Updated Branches:
refs/heads/branch_7x 761965224 -> 1fc4081be
SOLR-12880: Show the FacetProcessor class name instead of the
FacetRequest in the JSON Facets debug-trace output
Closes #474
(cherry picked from commit fbb987282e764aded31d7867e0d8f1fd6e2f02d4)
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/1fc4081b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1fc4081b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1fc4081b
Branch: refs/heads/branch_7x
Commit: 1fc4081becf782310fe9666b0da323b364725ed1
Parents: 7619652
Author: Tim Underwood <ti...@gmail.com>
Authored: Thu Nov 8 23:32:26 2018 -0500
Committer: David Smiley <ds...@apache.org>
Committed: Thu Nov 8 23:33:51 2018 -0500
----------------------------------------------------------------------
solr/CHANGES.txt | 3 +
.../apache/solr/search/facet/FacetHeatmap.java | 103 ++++++++++---------
.../apache/solr/search/facet/FacetRequest.java | 2 +-
3 files changed, 59 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1fc4081b/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index a0e8929..ea2108d 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -208,6 +208,9 @@ Improvements
* SOLR-12964: Json Facets: use DocValuesIterator advanceExact() instead of advance() in FacetFieldProcessorByHashDV and
UniqueSinglevaluedSlotAcc. (Tim Underwood)
+* SOLR-12880: Json Facets: Show the FacetProcessor class name instead of the FacetRequest in the JSON Facets debug-trace
+ output (Tim Underwood)
+
================== 7.5.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1fc4081b/solr/core/src/java/org/apache/solr/search/facet/FacetHeatmap.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/facet/FacetHeatmap.java b/solr/core/src/java/org/apache/solr/search/facet/FacetHeatmap.java
index b5e481a..c3386e2 100644
--- a/solr/core/src/java/org/apache/solr/search/facet/FacetHeatmap.java
+++ b/solr/core/src/java/org/apache/solr/search/facet/FacetHeatmap.java
@@ -208,62 +208,69 @@ public class FacetHeatmap extends FacetRequest {
@Override
public FacetProcessor createFacetProcessor(FacetContext fcontext) {
- return new FacetProcessor(fcontext, this) {
- @Override
- public void process() throws IOException {
- super.process(); // handles domain changes
-
- //Compute!
- final HeatmapFacetCounter.Heatmap heatmap;
- try {
- heatmap = HeatmapFacetCounter.calcFacets(
- strategy,
- fcontext.searcher.getTopReaderContext(),
- getTopAcceptDocs(fcontext.base, fcontext.searcher), // turn DocSet into Bits
- boundsShape,
- gridLevel,
- maxCells);
- } catch (IllegalArgumentException e) {//e.g. too many cells
- throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e.toString(), e);
- }
-
- //Populate response
- response = new SimpleOrderedMap();
- response.add("gridLevel", gridLevel);
- response.add("columns", heatmap.columns);
- response.add("rows", heatmap.rows);
- response.add("minX", heatmap.region.getMinX());
- response.add("maxX", heatmap.region.getMaxX());
- response.add("minY", heatmap.region.getMinY());
- response.add("maxY", heatmap.region.getMaxY());
+ return new FacetHeatmapProcessor(fcontext);
+ }
- //A shard request will always be a PNG
- String format = fcontext.isShard() ? FORMAT_PNG : FacetHeatmap.this.format;
+ // don't use an anonymous class since the getSimpleName() isn't friendly in debug output
+ private class FacetHeatmapProcessor extends FacetProcessor {
+ public FacetHeatmapProcessor(FacetContext fcontext) {
+ super(fcontext, FacetHeatmap.this);
+ }
- response.add("counts_" + format, formatCountsVal(format, heatmap.columns, heatmap.rows, heatmap.counts, fcontext.getDebugInfo()));
+ @Override
+ public void process() throws IOException {
+ super.process(); // handles domain changes
- // note: we do not call processStats or processSubs as it's not supported yet
+ //Compute!
+ final HeatmapFacetCounter.Heatmap heatmap;
+ try {
+ heatmap = HeatmapFacetCounter.calcFacets(
+ strategy,
+ fcontext.searcher.getTopReaderContext(),
+ getTopAcceptDocs(fcontext.base, fcontext.searcher), // turn DocSet into Bits
+ boundsShape,
+ gridLevel,
+ maxCells);
+ } catch (IllegalArgumentException e) {//e.g. too many cells
+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e.toString(), e);
}
- //TODO this is a general utility that should go elsewhere? DocSetUtil? Then should DocSetBase.getBits go away?
- private Bits getTopAcceptDocs(DocSet docSet, SolrIndexSearcher searcher) throws IOException {
- if (docSet.size() == searcher.numDocs()) {
- return null; // means match everything (all live docs). This can speedup things a lot.
- } else if (docSet.size() == 0) {
- return new Bits.MatchNoBits(searcher.maxDoc()); // can speedup things a lot
- } else if (docSet instanceof BitDocSet) {
- return ((BitDocSet) docSet).getBits();
- } else {
- // TODO DocSetBase.getBits ought to be at DocSet level? Though it doesn't know maxDoc but it could?
- FixedBitSet bits = new FixedBitSet(searcher.maxDoc());
- for (DocIterator iter = docSet.iterator(); iter.hasNext();) {
- bits.set(iter.nextDoc());
- }
- return bits;
+ //Populate response
+ response = new SimpleOrderedMap();
+ response.add("gridLevel", gridLevel);
+ response.add("columns", heatmap.columns);
+ response.add("rows", heatmap.rows);
+ response.add("minX", heatmap.region.getMinX());
+ response.add("maxX", heatmap.region.getMaxX());
+ response.add("minY", heatmap.region.getMinY());
+ response.add("maxY", heatmap.region.getMaxY());
+
+ //A shard request will always be a PNG
+ String format = fcontext.isShard() ? FORMAT_PNG : FacetHeatmap.this.format;
+
+ response.add("counts_" + format, formatCountsVal(format, heatmap.columns, heatmap.rows, heatmap.counts, fcontext.getDebugInfo()));
+
+ // note: we do not call processStats or processSubs as it's not supported yet
+ }
+
+ //TODO this is a general utility that should go elsewhere? DocSetUtil? Then should DocSetBase.getBits go away?
+ private Bits getTopAcceptDocs(DocSet docSet, SolrIndexSearcher searcher) throws IOException {
+ if (docSet.size() == searcher.numDocs()) {
+ return null; // means match everything (all live docs). This can speedup things a lot.
+ } else if (docSet.size() == 0) {
+ return new Bits.MatchNoBits(searcher.maxDoc()); // can speedup things a lot
+ } else if (docSet instanceof BitDocSet) {
+ return ((BitDocSet) docSet).getBits();
+ } else {
+ // TODO DocSetBase.getBits ought to be at DocSet level? Though it doesn't know maxDoc but it could?
+ FixedBitSet bits = new FixedBitSet(searcher.maxDoc());
+ for (DocIterator iter = docSet.iterator(); iter.hasNext();) {
+ bits.set(iter.nextDoc());
}
+ return bits;
}
+ }
- };
}
private static Object formatCountsVal(String format, int columns, int rows, int[] counts, FacetDebugInfo debugInfo) {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1fc4081b/solr/core/src/java/org/apache/solr/search/facet/FacetRequest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/facet/FacetRequest.java b/solr/core/src/java/org/apache/solr/search/facet/FacetRequest.java
index 658e0fc..4135c87 100644
--- a/solr/core/src/java/org/apache/solr/search/facet/FacetRequest.java
+++ b/solr/core/src/java/org/apache/solr/search/facet/FacetRequest.java
@@ -371,7 +371,7 @@ public abstract class FacetRequest {
debugInfo.setFilter(fcontext.filter.toString());
}
debugInfo.setReqDescription(getFacetDescription());
- debugInfo.setProcessor(getClass().getSimpleName());
+ debugInfo.setProcessor(facetProcessor.getClass().getSimpleName());
debugInfo.putInfoItem("domainSize", (long) fcontext.base.size());
RTimer timer = new RTimer();
facetProcessor.process();