You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2021/07/29 17:12:43 UTC

[lucene] 06/06: Simplify some code

This is an automated email from the ASF dual-hosted git repository.

mikemccand pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit 56eb76dbaf7b2e9a4fbf7c1a25af2ba81ab1bc92
Author: Gautam Worah <ga...@amazon.com>
AuthorDate: Wed Jul 28 10:01:29 2021 -0700

    Simplify some code
---
 .../facet/taxonomy/directory/DirectoryTaxonomyWriter.java    | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
index 38fa3f5..90f1d4e 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java
@@ -184,7 +184,11 @@ public class DirectoryTaxonomyWriter implements TaxonomyWriter {
     FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
     ft.setOmitNorms(true);
     parentStreamField = new Field(Consts.FIELD_PAYLOADS, parentStream, ft);
-    fullPathField = new StringField(Consts.FULL, "", Field.Store.NO);
+    if (useOlderStoredFieldIndex) {
+      fullPathField = new StringField(Consts.FULL, "", Field.Store.YES);
+    } else {
+      fullPathField = new StringField(Consts.FULL, "", Field.Store.NO);
+    }
 
     nextID = indexWriter.getDocStats().maxDoc;
 
@@ -476,11 +480,9 @@ public class DirectoryTaxonomyWriter implements TaxonomyWriter {
     d.add(parentStreamField);
 
     String fieldPath = FacetsConfig.pathToString(categoryPath.components, categoryPath.length);
+    fullPathField.setStringValue(fieldPath);
 
-    if (useOlderStoredFieldIndex) {
-      fullPathField = new StringField(Consts.FULL, fieldPath, Field.Store.YES);
-    } else {
-      fullPathField.setStringValue(fieldPath);
+    if (useOlderStoredFieldIndex == false) {
       /* Lucene 9 switches to BinaryDocValuesField for storing taxonomy categories */
       d.add(new BinaryDocValuesField(Consts.FULL, new BytesRef(fieldPath)));
     }