zacharymorn commented on a change in pull request #25:
URL: https://github.com/apache/lucene/pull/25#discussion_r602012262



##########
File path: lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
##########
@@ -388,6 +434,42 @@ private void processFacetFields(
     }
   }
 
+  private void indexDrillDownTerms(
+      Document doc, String indexFieldName, DimConfig ft, FacetLabel cp) {
+    if (ft.drillDownTermsIndexing != DrillDownTermsIndexing.NONE) {
+      // index full-path drill down term
+      doc.add(
+          new StringField(indexFieldName, pathToString(cp.components, 
cp.length), Field.Store.NO));
+
+      switch (ft.drillDownTermsIndexing) {
+        case NONE:

Review comment:
       > OK I looked, I think it would not be difficult. To improve this, we 
just have to make decisions about how we want switch-on-enums to work in our 
codebase.
   > 
   > For example, we could enable `missingEnumCaseDespiteDefault` which would 
mean that every enum value must be explicitly listed in every switch, even if a 
`default` case exists. As most enums are small, it would not be that annoying 
and would ensure compile-time safety if new enum values were added later.
   > 
   > This change would only impact switch statements on enums, so it might be 
worth looking into. We could still, separately, choose to enforce other things 
about switch statements in general such as requiring `default` case if we 
choose to do that, and it wouldn't break this check: we could just make it the 
pattern to throw an AssertionError from there for enums: all the values are 
known at compile-time, so we enforce no surprises.
   > And requiring `default` is good practice for switches on every other data 
type because all values are not known.
   
   Thanks Robert for the suggestion on this! I like both enforcement ideas. I 
gave `missingEnumCaseDespiteDefault` a try and can see a few need to be added 
already. Do you mind I create a spin-off issue for that and work on it 
separately? 




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to