lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsmi...@apache.org
Subject lucene-solr:master: SOLR-12880: Show the FacetProcessor class name instead of the FacetRequest in the JSON Facets debug-trace output
Date Fri, 09 Nov 2018 04:32:36 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master 780305cf4 -> fbb987282


SOLR-12880: Show the FacetProcessor class name instead of the
 FacetRequest in the JSON Facets debug-trace output


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/fbb98728
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/fbb98728
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/fbb98728

Branch: refs/heads/master
Commit: fbb987282e764aded31d7867e0d8f1fd6e2f02d4
Parents: 780305c
Author: Tim Underwood <timunderwood@gmail.com>
Authored: Thu Nov 8 23:32:26 2018 -0500
Committer: David Smiley <dsmiley@apache.org>
Committed: Thu Nov 8 23:32:26 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/fbb98728/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b8f9f18..3c58d35 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -296,6 +296,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/fbb98728/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/fbb98728/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();


Mime
View raw message