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:42 UTC

[lucene] 05/06: PR fixes 1. Change negation to 2. Move statement inside if condition

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 bd3174de10750a4d1cf858d5653868a41fe120dc
Author: Gautam Worah <ga...@amazon.com>
AuthorDate: Tue Jul 27 14:16:35 2021 -0700

    PR fixes 1. Change negation to  2. Move statement inside if condition
---
 .../lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java      | 4 ++--
 1 file changed, 2 insertions(+), 2 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 aad0b52..38fa3f5 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
@@ -157,7 +157,7 @@ public class DirectoryTaxonomyWriter implements TaxonomyWriter {
     // after we opened the writer, and the index is locked, it's safe to check
     // the commit data and read the index epoch
     openMode = config.getOpenMode();
-    if (!DirectoryReader.indexExists(directory)) {
+    if (DirectoryReader.indexExists(directory) == false) {
       indexEpoch = 1;
       // no commit exists so we can safely use the new BinaryDocValues field
       useOlderStoredFieldIndex = false;
@@ -476,11 +476,11 @@ 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);
       /* Lucene 9 switches to BinaryDocValuesField for storing taxonomy categories */
       d.add(new BinaryDocValuesField(Consts.FULL, new BytesRef(fieldPath)));
     }