rmuir commented on a change in pull request #25:
URL: https://github.com/apache/lucene/pull/25#discussion_r601951524
##########
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.
--
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]