timatbw commented on code in PR #2742:
URL: https://github.com/apache/solr/pull/2742#discussion_r1815497148


##########
solr/core/src/java/org/apache/solr/search/facet/FacetParser.java:
##########
@@ -138,21 +139,30 @@ public Object parseFacetOrStat(String key, Object o) 
throws SyntaxError {
     return parseFacetOrStat(key, type, args);
   }
 
+  public interface ParseHandler {
+    Object doParse(FacetParser<?> parent, String key, Object args) throws 
SyntaxError;
+  }
+
+  private static final Map<String, ParseHandler> REGISTERED_TYPES = new 
ConcurrentHashMap<>();
+
+  static {
+    ParseHandler fieldParser = (p, k, a) -> new FacetFieldParser(p, 
k).parse(a);
+    REGISTERED_TYPES.put("field", fieldParser);
+    REGISTERED_TYPES.put("terms", fieldParser);
+    REGISTERED_TYPES.put("query", (p, k, a) -> new FacetQueryParser(p, 
k).parse(a));
+    REGISTERED_TYPES.put("range", (p, k, a) -> new FacetRangeParser(p, 
k).parse(a));
+    REGISTERED_TYPES.put("heatmap", (p, k, a) -> new FacetHeatmap.Parser(p, 
k).parse(a));
+    REGISTERED_TYPES.put("func", (p, k, a) -> p.parseStat(k, a));
+  }
+
+  public static void registerParseHandler(String type, ParseHandler 
parseHandler) {

Review Comment:
   Yes all good points, I'm going to change this to remove the statics and make 
it per-core which probably fits better with how it's hooked in too



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to