gsmiller commented on a change in pull request #25:
URL: https://github.com/apache/lucene/pull/25#discussion_r599193102
##########
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:
Yeah, that's fair. My thinking was that the loop start being the only
difference could be overlooked in a future change, but I don't really have
strong opinions here. Thanks for considering a different approach :)
--
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]