zacharymorn commented on a change in pull request #25:
URL: https://github.com/apache/lucene/pull/25#discussion_r599171007
##########
File path: lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
##########
@@ -371,14 +426,26 @@ private void processFacetFields(
}
// Drill down:
- int start;
- if (ft.requireDimensionDrillDown) {
- start = 1;
- } else {
- start = 2;
- }
- for (int i = start; i <= cp.length; i++) {
- doc.add(new StringField(indexFieldName, pathToString(cp.components,
i), Field.Store.NO));
+ if (ft.drillDownTermsIndexing != DrillDownTermsIndexing.NONE) {
+ StringField fullPathField =
+ new StringField(
+ indexFieldName, pathToString(cp.components, cp.length),
Field.Store.NO);
+ doc.add(fullPathField);
+
+ if (ft.drillDownTermsIndexing ==
DrillDownTermsIndexing.DIMENSION_AND_FULL_PATH) {
+ doc.add(
+ new StringField(indexFieldName, pathToString(cp.components,
1), Field.Store.NO));
+ } else if (ft.drillDownTermsIndexing ==
DrillDownTermsIndexing.ALL_PATHS_NO_DIM) {
+ for (int i = 2; i < cp.length; i++) {
+ doc.add(
+ new StringField(indexFieldName, pathToString(cp.components,
i), Field.Store.NO));
+ }
+ } else if (ft.drillDownTermsIndexing == DrillDownTermsIndexing.ALL) {
+ for (int i = 1; i < cp.length; i++) {
+ doc.add(
+ new StringField(indexFieldName, pathToString(cp.components,
i), Field.Store.NO));
+ }
+ }
Review comment:
hmmm tbh I actually preferred the existing one for readability as each
option is checked once, whereas the suggested one has additional branching to
check for one option twice. I see both styles having their pros & cons...
--
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]